Migrate build to Gradle 9.6.1 / AGP 9 and update dependencies#792
Merged
Conversation
Gradle 9.6 removed the internal API that AGP 8.13 relied on, forcing the AGP 9 upgrade and the surrounding build-script changes. Toolchain: - Gradle wrapper 9.3.1 -> 9.6.1; AGP 8.13.1 -> 9.3.1; apksig follows AGP. - Adopt AGP 9 built-in Kotlin: remove org.jetbrains.kotlin.android from all Android modules; Kotlin stdlib 2.3.10 -> 2.4.10. - compileSdk/targetSdk 36 -> 37, build-tools 37.0.0. Build-script migration: - Root build configures the shared CommonExtension through its getters, since AGP 9 dropped the action-DSL methods on that type. - daemon generates SignInfo through androidComponents.onVariants and a typed task; android.applicationVariants was removed. Resource generators (replace the rikka autoResConfig / materialthemebuilder plugins, whose entry points use removed AGP variant APIs): - buildSrc/GenerateLangListTask scans the translated locales. - buildSrc/GenerateMaterialThemeTask computes the accent-color theme overlays, reusing the materialthemebuilder color library without applying its plugin. Drop android.nonFinalResIds=false: AGP 9 enables optimized resource shrinking by default, and that shrinker requires non-final resource IDs. With isShrinkResources=true the manager's release build now fails :app:minifyReleaseWithR8 with "Optimized resource shrinking requires non-final IDs". AGP offers two remedies: make the IDs non-final, or opt out of optimized shrinking (r8.optimizedResourceShrinking= false). We take the former, because the false setting turns out to be dead weight: - It was added in 348f049 (Aug 2023), an unrelated "show packagename" feature commit, as a one-line drop-in beside the now-removed experimental flags enableAppCompileTimeRClass / enableNewResourceShrinker.preciseShrinking. Those siblings were cleaned up later; this line was simply missed. - Final IDs are only actually required to use R.* as Java switch/case labels. There are zero `case R.*` occurrences in the tree at 348f049 and at every commit since, so the flag never protected anything here. - Non-final IDs are the modern AGP default, so removing the line (rather than writing =true) expresses the intent with no config at all. It also builds smaller: the optimized shrinker trims the release APK from ~3.45 MB to ~3.13 MB (~9%). Verified end to end -- assembleRelease plus a zygisk installKsuAndReboot run that loads the module and starts lspd on device. Formatting task: - Add buildSrc/src/main/kotlin to the format task so the generator sources are formatted with the rest of the Kotlin build logic. - Exclude daemon/**, which is intentionally kept on ktfmt's default (Meta) style; formatting it here fought :daemon:ktfmtFormat and flipped the style back and forth. Dependencies: - AGP/apksig 9.3.1, Kotlin 2.4.10, androidx.core 1.19.0 (dependabot maven group). - coroutines 1.11.0, okhttp 5.4.0, gson 2.14.0, nav 2.9.8, glide 5.0.9, androidx activity/browser/annotation, ktfmt 0.26.0. - Material kept at 1.12.0; 1.13+ removes the colorPrimary/colorError attrs the manager references. - Submodules fmt and commons-lang bumped; CI action versions bumped (actions/checkout 6 -> 7, actions/cache 5 -> 6).
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.
Summary
Migrates the build to Gradle 9.6.1 / AGP 9.3.1 and folds in the outstanding dependency bumps. Gradle 9.6 removed the internal API AGP 8.13 relied on, which forced the AGP 9 upgrade and the surrounding build-script rework.
Toolchain
org.jetbrains.kotlin.androidfrom all Android modules); Kotlin stdlib → 2.4.10.Build-script migration
CommonExtensionthrough its getters (AGP 9 dropped the action-DSL methods).daemongeneratesSignInfoviaandroidComponents.onVariants+ a typed task (android.applicationVariantswas removed).autoResConfig/materialthemebuilderplugins (their entry points use removed AGP variant APIs) withbuildSrctasks:GenerateLangListTaskandGenerateMaterialThemeTask.Fix
:app:minifyReleaseWithR8failureAGP 9 enables optimized resource shrinking by default, which requires non-final resource IDs, so the release build failed with "Optimized resource shrinking requires non-final IDs". This drops the stale
android.nonFinalResIds=false— an orphan left over from now-removed experimental resource-shrinker flags (verified: zerocase R.*usages in the tree since the flag was introduced, so final IDs were never needed here). Using the AGP 9 default also trims the release APK ~3.45 MB → ~3.13 MB (~9%).Dependencies (dependabot #791 / #790)
colorPrimary/colorErrorattrs the manager references).fmtandcommons-langbumped; CI actions bumped (actions/checkout6 → 7,actions/cache5 → 6).Formatting task
buildSrc/src/main/kotlinso the generator sources are formatted with the rest of the Kotlin build logic.daemon/**, which is intentionally kept on ktfmt's default (Meta) style (formatting it here fought:daemon:ktfmtFormat).Testing
:app:assembleReleaseand all Kotlin modules compile on AGP 9.3.1 / Kotlin 2.4.10.installKsuAndRebootDebugbuilds the module (native for both ABIs), installs viaksud, and after reboot thezygisk_vectormodule is enabled andlspdruns.Closes #790, #791.
🤖 Generated with Claude Code