Skip to content

Gradle 9 update#5

Open
Kai-Cilliers wants to merge 13 commits intomasterfrom
gradle-9-update
Open

Gradle 9 update#5
Kai-Cilliers wants to merge 13 commits intomasterfrom
gradle-9-update

Conversation

@Kai-Cilliers
Copy link
Copy Markdown
Collaborator

Summary

  • Migrate from Gradle 8.x to Gradle 9 with AGP 9.0.0-rc02
  • update Kotlin to 2.3.0 and Compose Multiplatform to 1.9.3
  • replace com.android.library with the new com.android.kotlin.multiplatform.library plugin for all KMP library modules.

Key Changes

Build Infrastructure

  • Gradle Wrapper: Upgraded to Gradle 9
  • AGP: Updated to 9.0.0-rc02 (minimum required for the new KMP library plugin)
  • KSP: Updated to match Kotlin 2.3.0

Plugin Migration

All library modules now use com.android.kotlin.multiplatform.library with direct androidLibrary {} configuration blocks instead of the legacy com.android.library + separate KMP setup. This is the recommended approach for KMP projects going forward.

Convention Plugin Updates

  • Updated KmpLibraryConventionPlugin to use the new plugin
  • Fixed source set hierarchy template for AGP 9.0 compatibility
  • Added KotlinAndroidTarget helper for the new configuration style

Gradle Properties

Removed deprecated properties that are no longer needed:

  • android.usesSdkInManifest.disallowed
  • android.r8.optimizedResourceShrinking
  • android.defaults.buildfeatures.resvalues
  • android.enableAppCompileTimeRClass

Retained (with documentation) properties required for KMP compatibility:

  • android.builtInKotlin=false — Prevents conflict with KMP's kotlin extension
  • android.newDsl=false — Convention plugins require the legacy BaseExtension API

…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.
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)
Copy link
Copy Markdown

Copilot AI left a 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 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.library plugin with androidLibrary {} configuration blocks
  • Refactored source set hierarchy to remove global jvmCommon group, requiring explicit dependsOn() 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.

# 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
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a spacing issue in the comment. 'BaseExtensionsAPI' should have a space before 'API' to read as 'BaseExtensions API'.

Suggested change
# New DSL removes `BaseExtensions`API
# New DSL removes `BaseExtensions` API

Copilot uses AI. Check for mistakes.
[versions]
# Build tools
agp = "8.11.1"
agp = "9.0.0-rc02"
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
agp = "9.0.0-rc02"
agp = "9.0.0"

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +9
compileSdk = 36
minSdk = 26
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
compileSdk = 36
minSdk = 26

Copilot uses AI. Check for mistakes.
* Android library settings (namespace, compileSdk, minSdk) must be configured in each module's
* build.gradle.kts using kotlin { androidLibrary { ... } }
*/
internal fun Project.configureAndroidLibraryTarget() {
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
internal fun Project.configureAndroidLibraryTarget() {
internal fun Project.configureAndroidLibraryTarget() {
extensions.configure<KotlinMultiplatformExtension> {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
}

Copilot uses AI. Check for mistakes.

androidDesugarJdkLibs = "2.1.5"
androidTools = "31.12.0"
androidTools = "32.0.0-rc02"
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
androidTools = "32.0.0-rc02"
androidTools = "9.0.0-rc02"

Copilot uses AI. Check for mistakes.
philipplackner and others added 3 commits January 19, 2026 11:21
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants