ADFA-2602: Move the on-device toolchain to Gradle 9.6.1, AGP 9.3.1, Kotlin 2.3.21 - #1647
Conversation
…otlin 2.3.21
Collapses the duplicate Kotlin compilers the device was shipping. Gradle
9.6.1 embeds Kotlin 2.3.21, and AGP 9's built-in Kotlin resolves the same
2.3.21 compiler, so the build-script compiler and the app compiler are one
artifact instead of two at different versions.
Version choice is constrained from both ends and is not free:
- AGP 9.3.1 requires Gradle 9.5.0+
- AGP 8.x fails on Gradle 9.6.0+ (it uses InternalProblems, removed there)
- Gradle's embedded Kotlin is fixed per version: 9.4.1 -> 2.3.0,
9.5.1 -> 2.3.20, 9.6.1 -> 2.3.21, 9.7.0 -> 2.4.0
Bumping agp-tooling to match the device forces a model migration, so it
lands here rather than separately -- splitting it would leave a commit that
does not compile. AGP 9 removed PrivacySandboxSdkInfo and
AndroidProject.PROPERTY_ANDROID_SUPPORT_VERSION (value inlined as
"android.injected.studio.version"), and added mappingR8TextFile,
mappingR8PartitionFile, keepRulesDirectories and aarKeepRulesDirectories.
app/build.gradle.kts now derives the bundled asset filenames from the
version constants instead of repeating "8.14.3" in six string literals.
Note the asset rename: builds resolve gradle-9.6.1-bin.zip, which must be
published to dev-assets before this lands or local assetsDownloadDebug
returns 404.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
| // POM stays dependency-free: forcing it as a transitive would make the coordinate | ||
| // unresolvable offline whenever the harvested AGP differs from a pinned version. | ||
| compileOnly("com.android.tools.build:gradle:8.11.0") | ||
| compileOnly("com.android.tools.build:gradle:9.3.1") |
There was a problem hiding this comment.
Re-use the lib.versions.agpTooling property here - it is not recommended to define version numbers at multiple sites.
itsaky-adfa
left a comment
There was a problem hiding this comment.
There's one minor issue to be fixed (see the previous review).
|
also there's a issue when assembleRelease the apk with AGP 9.3.1 and Gradle 9.7.0 |
After doing some tests I found that the problem had nothing to do with AGP or Gradle |
Replace the hardcoded AGP 9.3.1 in plugin-builder's compileOnly with a tooling-agp catalog alias so the version is defined once. plugin-builder is also an included/standalone build, so import the root catalog in its settings (same pattern as composite-builds/build-logic).
Moves the on-device toolchain to Gradle 9.6.1 + AGP 9.3.1 + Kotlin 2.3.21, which collapses the duplicate Kotlin compilers the device was shipping. Gradle 9.6.1 embeds Kotlin 2.3.21 and AGP 9's built-in Kotlin resolves the same 2.3.21 compiler, so the build-script compiler and the app compiler become one artifact.
Why these exact versions
The window is constrained from both ends:
InternalProblems, removed there)This is a one-way move: at 9.6.1 there is no falling back to AGP 8 without also moving Gradle back.
Why the model migration is in the same commit
Bumping
agp-toolingto match the device breaksbuilder-model-impl, and the migration can't land first either — overriding members that don't exist in AGP 8.13.1 won't compile. Splitting them would leave a red commit in the stack.AGP 9 removed
PrivacySandboxSdkInfoandAndroidProject.PROPERTY_ANDROID_SUPPORT_VERSION(value inlined asandroid.injected.studio.version), and addedmappingR8TextFile,mappingR8PartitionFile,keepRulesDirectories,aarKeepRulesDirectories.