Refactor: Separate Android App Module for AGP 9.0 Compatibility#34
Merged
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
Contributor
There was a problem hiding this comment.
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
approved these changes
Dec 29, 2025
l2hyunwoo
left a comment
Owner
There was a problem hiding this comment.
LGTM 👍🏻 Thanks for your contribution.
|
Awesooome @angryPodo thank you!! ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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