Conversation
…y for general KMP optimizations
…android.kotlin.multiplatform.library (Kotlin version already exceeds min of 2.2.0-Beta2)
…orm.library plugin and replace the configuration blocks
Update AGP to 9.0.0-rc02, Compose Multiplatform to 1.9.3, and migrate
all library modules to com.android.kotlin.multiplatform.library plugin
with direct androidLibrary {} configuration.
…xt to two key properties
Separate Android application from KMP module to fix the deprecation warning about org.jetbrains.kotlin.multiplatform being incompatible with com.android.application in AGP 9.0. - Create dedicated :androidApp module with com.android.application - Move MainActivity, ChirpApplication, manifest, and res to androidApp - Convert composeApp to use com.android.kotlin.multiplatform.library - Update CmpApplicationConventionPlugin to use library plugin - Add kotlin.android plugin to AndroidApplicationConventionPlugin - Add required dependencies (activity-compose, splashscreen) to androidApp
Remove deprecated kotlin.android plugin usage now that AGP 9.0 has built-in Kotlin compilation support. - Remove android.newDsl=false and android.builtInKotlin=false from gradle.properties - Remove kotlin.android plugin from AndroidApplicationConventionPlugin - Remove kotlinOptions block from androidApp (handled by convention plugin)
There was a problem hiding this comment.
Pull request overview
This PR migrates the project from Gradle 8.x to Gradle 9.1.0, updating the Android Gradle Plugin to 9.0.0-rc02, Kotlin to 2.3.0, and Compose Multiplatform to 1.9.3. The migration adopts the new com.android.kotlin.multiplatform.library plugin for all KMP library modules, replacing the legacy com.android.library approach.
Changes:
- Updated Gradle wrapper to 9.1.0 and key dependencies (AGP, Kotlin, KSP, Compose Multiplatform, Android Tools)
- Migrated all library modules to use the new
com.android.kotlin.multiplatform.libraryplugin withandroidLibrary {}configuration blocks - Refactored source set hierarchy to remove global
jvmCommongroup, requiring explicitdependsOn()for modules sharing Android/Desktop JVM code - Added KMP-specific Gradle properties and updated convention plugins
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| gradle/wrapper/gradle-wrapper.properties | Updated Gradle distribution to version 9.1.0 |
| gradle/libs.versions.toml | Updated AGP to 9.0.0-rc02, Kotlin to 2.3.0, KSP to 2.3.4, Compose Multiplatform to 1.9.3, and Android Tools to 32.0.0-rc02 |
| gradle.properties | Added KMP configuration properties for built-in Kotlin compatibility and DSL requirements |
| feature/*/build.gradle.kts | Added androidLibrary {} configuration blocks with namespace, compileSdk, and minSdk for all feature modules |
| core/*/build.gradle.kts | Added androidLibrary {} configuration blocks for all core modules; updated source set dependencies in core/data and core/presentation |
| build-logic/convention/.../KotlinMultiplatform.kt | Removed LibraryExtension configuration and switched to new library target configuration |
| build-logic/convention/.../KotlinAndroidTarget.kt | Added configureAndroidLibraryTarget() function for new KMP library plugin support |
| build-logic/convention/.../KotlinAndroid.kt | Changed parameter from CommonExtension to ApplicationExtension for application-specific configuration |
| build-logic/convention/.../HierarchyTemplate.kt | Removed global jvmCommon source set group to avoid AGP 9.0 compilation conflicts |
| build-logic/convention/.../AndroidCompose.kt | Changed parameter from CommonExtension to ApplicationExtension |
| build-logic/convention/.../KmpLibraryConventionPlugin.kt | Updated to use new com.android.kotlin.multiplatform.library plugin and removed legacy configuration |
| build-logic/convention/.../CmpLibraryConventionPlugin.kt | Changed from debugImplementation to androidMainImplementation for single-variant model |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gradle.properties
Outdated
| # https://kotlinlang.org/docs/mpp-share-on-platforms.html#use-native-libraries-in-the-hierarchical-structure | ||
| kotlin.mpp.enableCInteropCommonization=true | ||
|
|
||
| # New DSL removes `BaseExtensions`API |
There was a problem hiding this comment.
There's a spacing issue in the comment. 'BaseExtensionsAPI' should have a space before 'API' to read as 'BaseExtensions API'.
| # New DSL removes `BaseExtensions`API | |
| # New DSL removes `BaseExtensions` API |
| [versions] | ||
| # Build tools | ||
| agp = "8.11.1" | ||
| agp = "9.0.0-rc02" |
There was a problem hiding this comment.
Using AGP version '9.0.0-rc02' which is a release candidate, not a stable release. Consider the stability implications for production use, especially with the significant architectural changes in this migration. RC versions may have unresolved issues and are not recommended for production builds unless thoroughly tested.
| agp = "9.0.0-rc02" | |
| agp = "9.0.0" |
| compileSdk = 36 | ||
| minSdk = 26 |
There was a problem hiding this comment.
The androidLibrary configuration blocks are now duplicated across all library modules with identical compileSdk and minSdk values (36 and 26 respectively). Consider moving these common configurations to the convention plugin to reduce duplication and ensure consistency. Only the namespace would need to remain in individual modules.
| compileSdk = 36 | |
| minSdk = 26 |
| * Android library settings (namespace, compileSdk, minSdk) must be configured in each module's | ||
| * build.gradle.kts using kotlin { androidLibrary { ... } } | ||
| */ | ||
| internal fun Project.configureAndroidLibraryTarget() { |
There was a problem hiding this comment.
The configureAndroidLibraryTarget function only adds desugaring dependencies but doesn't configure compiler options like jvmTarget.set(JvmTarget.JVM_17) that are set in configureAndroidTarget for applications. Verify that the new 'com.android.kotlin.multiplatform.library' plugin automatically inherits these compiler settings, or add explicit configuration to ensure library modules compile with JVM 17 target.
| internal fun Project.configureAndroidLibraryTarget() { | |
| internal fun Project.configureAndroidLibraryTarget() { | |
| extensions.configure<KotlinMultiplatformExtension> { | |
| androidTarget { | |
| @OptIn(ExperimentalKotlinGradlePluginApi::class) | |
| compilerOptions { | |
| jvmTarget.set(JvmTarget.JVM_17) | |
| } | |
| } | |
| } |
|
|
||
| androidDesugarJdkLibs = "2.1.5" | ||
| androidTools = "31.12.0" | ||
| androidTools = "32.0.0-rc02" |
There was a problem hiding this comment.
The androidTools version '32.0.0-rc02' is a release candidate and should match the AGP version. Verify this is the correct version that corresponds to AGP 9.0.0-rc02.
| androidTools = "32.0.0-rc02" | |
| androidTools = "9.0.0-rc02" |
Restructure project for AGP 9.0 compatibility
- Update Compose Multiplatform from 1.9.3 to 1.10.0 - Update AGP from 9.0.0 to 9.0.0-rc02 - Update compose-lifecycle to 2.10.0-alpha06 - Update navigation-compose to 2.9.1 - Update adaptive to 1.3.0-alpha02 - Remove compose-hot-reload plugin (no longer needed) - Add explicit compose-resources and ui-tooling-preview dependencies (now separate modules in CMP 1.10.0) - Remove centralized KotlinMultiplatformAndroidLibraryExtension config from convention plugin - Add androidLibrary blocks with namespace/SDK config to all modules - Update Preview import from org.jetbrains.compose to androidx.compose - Update resource imports to use new packageOfResClass pattern
Summary
com.android.librarywith the newcom.android.kotlin.multiplatform.libraryplugin for all KMP library modules.Key Changes
Build Infrastructure
Plugin Migration
All library modules now use
com.android.kotlin.multiplatform.librarywith directandroidLibrary {}configuration blocks instead of the legacycom.android.library+ separate KMP setup. This is the recommended approach for KMP projects going forward.Convention Plugin Updates
KmpLibraryConventionPluginto use the new pluginKotlinAndroidTargethelper for the new configuration styleGradle Properties
Removed deprecated properties that are no longer needed:
android.usesSdkInManifest.disallowedandroid.r8.optimizedResourceShrinkingandroid.defaults.buildfeatures.resvaluesandroid.enableAppCompileTimeRClassRetained (with documentation) properties required for KMP compatibility:
android.builtInKotlin=false— Prevents conflict with KMP's kotlin extensionandroid.newDsl=false— Convention plugins require the legacyBaseExtensionAPI