Repository navigation
build: upgrade AGP to 9.4.0 and Gradle to 9.7.1 - #626
Merged
Merged
Conversation
fortuna
added this pull request to stack #624
September 15, 2026 17:15
This was referenced Sep 15, 2026
AGP 8.5.1 was only tested up to compileSdk 34 and warned on every build now that the project compiles against 36. AGP 9.4.0 supports it natively, so the warning is gone. Required changes: * Firebase Gradle plugins. perf-plugin 1.4.1 uses the Transform API and applicationVariants, both removed in AGP 9, and failed to load at all. Upgraded google-services 4.4.1 -> 4.5.0, perf-plugin 1.4.1 -> 2.0.2 and firebase-crashlytics-gradle 2.8.1 -> 3.0.8. * buildFeatures. AGP 9 removed android.defaults.buildfeatures.buildconfig and no longer enables resValues implicitly, so both are now requested in app/build.gradle. LogWrapper reads BuildConfig.DEBUG and the build types declare the FIREBASE_ENABLED resValue. * compileGoBackend used android.sdkDirectory, removed in AGP 9. Use the androidComponents.sdkComponents.sdkDirectory provider instead. * android.nonFinalResIds=false is no longer honored, so the switch statements over R.id in MainActivity stopped compiling. Converted them to if/else chains, matching the existing id == R.id.frame_main check, and dropped the dead flag. * Regenerated buildscript-gradle.lockfile and verification-metadata.xml. The aapt2 linux and windows checksums were added by hand from the published .sha256 files, because regenerating on macOS only records the host binary. ./gradlew clean assembleDebug test passes with strict dependency verification.
peterwgnd
force-pushed
the
build/upgrade-agp
branch
from
September 15, 2026 18:17
fe7622f to
277a158
Compare
fortuna
removed this pull request from stack #624
September 15, 2026 18:21
fortuna
added this pull request to stack #629
September 15, 2026 18:22
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
Upgrades the Android Gradle Plugin from 8.5.1 to 9.4.0 (latest stable) and Gradle from
8.7 to 9.7.1.
Why
AGP 8.5.1 was only tested up to
compileSdk = 34. Since #623 compiles against 36, everybuild printed:
AGP 9.4.0 supports compileSdk 36 natively, so the warning is gone.
What AGP 9 broke, and how it was fixed
perf-plugin:1.4.1usescom.android.build.api.transform.TransformandapplicationVariants, both removed in AGP 9. The plugin failed to load.4.4.1 -> 4.5.0, perf-plugin1.4.1 -> 2.0.2, crashlytics-gradle2.8.1 -> 3.0.8.android.defaults.buildfeatures.buildconfigwas removed in AGP 9, butLogWrapperreadsBuildConfig.DEBUG.buildFeatures { buildConfig = true }inapp/build.gradle.resValuesis no longer implicitly enabled, but both build types declareFIREBASE_ENABLED.buildFeatures { resValues = true }.compileGoBackendreadandroid.sdkDirectory, removed in AGP 9.androidComponents.sdkComponents.sdkDirectoryprovider.android.nonFinalResIds=falseis no longer honored, so theswitchstatements overR.idinMainActivitystopped compiling (constant expression required).if/else ifchains, matching theid == R.id.frame_maincheck that already existed a few lines below. Dropped the dead flag.Regenerated lock and verification files
buildscript-gradle.lockfileandgradle/verification-metadata.xmlwere regenerated forthe new plugin graph.
Important
Regenerating on macOS records only the host
aapt2binary, which would havereintroduced exactly the bug #625 fixes, just with the platforms swapped. The
aapt2-9.4.0-15978811linuxandwindowschecksums were therefore added by handfrom the published
.sha256files. As a cross-check, theosxchecksum that Gradlegenerated matches its published
.sha256exactly.Verification
./gradlew clean assembleDebug testpasses with strict dependency verification.Not addressed here
The newer lint bundled with AGP 9 reports two additional pre-existing errors that are
unrelated to the build tooling:
GestureBackNavigation—MainActivity.onBackPressed()is not called underpredictive back. This is a real bug affecting in-app back navigation, but fixing
it properly means migrating to
OnBackPressedDispatcher, which needs AppCompat newerthan the pinned 1.4.0 (it resolves
androidx.activity:activity:1.2.4, too old tobridge the platform callback). Worth its own PR.
NewApi—IntraTileServicerequires API 24 whileminSdkis 21. Guarded atruntime by the system, so this is a lint annotation gap.
android.enableJetifierandandroid.nonTransitiveRClassare deprecated and will beremoved in AGP 10; both are left as TODOs since migrating them needs a separate audit.