build: migrate KMP Android DSL from androidLibrary {} to android {}#5734
Merged
Conversation
AGP 9.2.1 introduced `android {}` (in `kotlin {}`) to replace
`androidLibrary {}`, which is deprecated since AGP 9.1.0-alpha09 and
slated for removal. Rename the block across all 22 KMP library modules
and update the stale comment in the convention plugin.
The `findByType<KotlinMultiplatformAndroidLibraryTarget>()` calls in
build-logic are unchanged: that type still backs the target and
`...Target extends ...Extension` in the AGP 9.2.1 API.
Verified: ./gradlew help, build --dry-run, spotlessCheck, detekt,
assembleDebug, test, allTests all pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Renames the Kotlin Multiplatform Android DSL block from the deprecated
androidLibrary { }toandroid { }across all 22 KMP library modules.Why
On AGP 9.2.1 (our current version),
android { }(insidekotlin { }) is the documented block for thecom.android.kotlin.multiplatform.libraryplugin.androidLibrary { }is deprecated since AGP 9.1.0-alpha09 and slated for removal in a future release (expected AGP 10.0). Per the official Android-KMP plugin docs: "Starting with AGP 8.12.0, a newandroid{}block was introduced to replaceandroidLibrary{}."Changes
androidLibrary {→android {in 22 modulebuild.gradle.ktsfiles (core/*,feature/*)The
findByType<KotlinMultiplatformAndroidLibraryTarget>()calls inbuild-logicare unchanged — verified against the AGP 9.2.1 API jar that this type still backs the target and...Target extends ...Extension, so the accessor rename doesn't affect target lookup.Verification
./gradlew help— all modules configure cleanly, no unresolved-reference or deprecation warnings./gradlew build --dry-run— full task graph wires up./gradlew spotlessApply spotlessCheck detekt assembleDebug test allTests— all pass (spotless introduced no changes)Also audited the rest of the build for AGP 9 / Kotlin 2.3 deprecations (kotlinOptions, kapt, jcenter, legacy variant API, deprecated gradle.properties flags, manifest
package=, etc.) — none found. Confirmed all module tests execute (no silently-skipped suites).🤖 Generated with Claude Code