Skip to content

Migrate build to Gradle 9.6.1 / AGP 9 and update dependencies#792

Merged
JingMatrix merged 1 commit into
masterfrom
agp9-migration
Jul 25, 2026
Merged

Migrate build to Gradle 9.6.1 / AGP 9 and update dependencies#792
JingMatrix merged 1 commit into
masterfrom
agp9-migration

Conversation

@JingMatrix

@JingMatrix JingMatrix commented Jul 25, 2026

Copy link
Copy Markdown
Owner

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

  • Gradle wrapper 9.3.1 → 9.6.1; AGP 8.13.1 → 9.3.1 (apksig follows AGP).
  • Adopt AGP 9 built-in Kotlin (drop org.jetbrains.kotlin.android from all Android modules); Kotlin stdlib → 2.4.10.
  • compileSdk/targetSdk 36 → 37, build-tools 37.0.0.

Build-script migration

  • Root build configures the shared CommonExtension through its getters (AGP 9 dropped the action-DSL methods).
  • daemon generates SignInfo via androidComponents.onVariants + a typed task (android.applicationVariants was removed).
  • Replaced the rikka autoResConfig / materialthemebuilder plugins (their entry points use removed AGP variant APIs) with buildSrc tasks: GenerateLangListTask and GenerateMaterialThemeTask.

Fix :app:minifyReleaseWithR8 failure

AGP 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: zero case 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)

  • AGP/apksig 9.3.1, Kotlin 2.4.10, androidx.core 1.19.0.
  • 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 actions bumped (actions/checkout 6 → 7, actions/cache 5 → 6).

Formatting task

  • Include buildSrc/src/main/kotlin 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).

Testing

  • :app:assembleRelease and all Kotlin modules compile on AGP 9.3.1 / Kotlin 2.4.10.
  • ✅ Real device (Pixel 6, KernelSU): installKsuAndRebootDebug builds the module (native for both ABIs), installs via ksud, and after reboot the zygisk_vector module is enabled and lspd runs.

Closes #790, #791.

🤖 Generated with Claude Code

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).
@JingMatrix
JingMatrix merged commit 7fd88c9 into master Jul 25, 2026
1 check passed
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.

1 participant