-
Notifications
You must be signed in to change notification settings - Fork 4
Refactor: Separate Android App Module for AGP 9.0 Compatibility #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: Separate Android App Module for AGP 9.0 Compatibility #34
Conversation
- Move shared KMP code to `sample/shared` - Move Android entry point to `sample/android-app` - Update Gradle settings to include new modules - Fix iOS project reference to point to shared module task - Resolves #31
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR successfully refactors the sample module structure to comply with Android Gradle Plugin (AGP) 9.0 requirements, which deprecates the use of com.android.application and kotlin("multiplatform") plugins in the same module. The refactoring separates the Android application entry point from the Kotlin Multiplatform shared code.
Key Changes:
- Split the
:samplemodule into:sample:shared(KMP library) and:sample:android-app(Android application) - Migrated shared Kotlin Multiplatform code (including commonMain, androidMain, and iosMain source sets) to the new
:sample:sharedmodule - Created a new Android-only
:sample:android-appmodule that depends on:sample:sharedand serves as the application entry point - Updated iOS project configuration to reference the new framework output path from
:sample:shared
Reviewed changes
Copilot reviewed 4 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| settings.gradle.kts | Updated module includes from :sample to :sample:shared and :sample:android-app |
| sample/shared/build.gradle.kts | Converted from android.application to android.kotlin.multiplatform.library plugin with appropriate KMP configuration |
| sample/android-app/build.gradle.kts | New Android application module with kotlin-android plugin and dependency on :sample:shared |
| sample/android-app/src/main/AndroidManifest.xml | Android app manifest with camera permissions and MainActivity declaration |
| sample/android-app/src/main/kotlin/.../MainActivity.kt | Android app entry point that launches the shared SampleApp composable |
| sample/android-app/src/main/res/* | Android app resources including theme and strings definitions |
| sample/shared/src/commonMain/kotlin/* | Shared KMP source files moved from original sample module including SampleApp, CameraScreen, GalleryScreen, BarcodeScannerScreen, and related utilities |
| sample/shared/src/androidMain/kotlin/* | Android-specific implementations of MediaLoader, MediaThumbnail, and BackHandler |
| sample/shared/src/iosMain/kotlin/* | iOS-specific implementations including MainViewController, MediaLoader, MediaThumbnail, and BackHandler |
| iosApp/iosApp.xcodeproj/project.pbxproj | Updated framework search paths and Gradle task references to point to :sample:shared instead of :sample |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
l2hyunwoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏻 Thanks for your contribution.
|
Awesooome @angryPodo thank you!! ❤️ |
Overview
This PR addresses issue #31 by refactoring the
samplemodule structure to comply with upcoming Android Gradle Plugin (AGP) 9.0 requirements.Starting with AGP 9.0, applying
com.android.applicationandkotlin("multiplatform")in the same module is deprecated. This PR separates the Android application entry point from the KMP shared code.Structural Changes
Before
After
Related Issue
Resolves #31