Skip to content

build: upgrade to Gradle 9.9.1, AGP 9.5.1 and Java 25 - #1357

Closed
TonyRL wants to merge 3 commits into
ReadYouApp:mainfrom
TonyRL:chore/java-25-gradle-9
Closed

TonyRL wants to merge 3 commits into
ReadYouApp:mainfrom
TonyRL:chore/java-25-gradle-9

Conversation

@TonyRL

@TonyRL TonyRL commented Nov 17, 2026

Copy link
Copy Markdown

Summary

  • Upgrade the Gradle wrapper from 8.13 to 9.9.1. The wrapper scripts and jar are regenerated.
  • Upgrade the Android Gradle Plugin (AGP) from 8.13.0 to 9.5.1. Gradle 9.6 and later reject AGP 8, so this upgrade is required.
  • Remove the separate Kotlin Android plugin. AGP 9 includes Kotlin support.
  • Move the Kotlin compiler options and the APK file name logic to the AGP 9 APIs in app/build.gradle.kts. The APK name does not change.
  • Bump Kotlin to 2.2.21, KSP to 2.3.14, Dagger/Hilt to 2.60.1 and Mockito to 5.24.0. Mockito 5.11.0 cannot read Java 25 class files.
  • Add two AGP 9 settings. android.onlyEnableUnitTestForTheTestedBuildType=false keeps the testGithubReleaseUnitTest task. isIncludeAndroidResources = true keeps ./gradlew tasks working.
  • Set both workflows to Java 25 for the build. The app bytecode target stays at Java 11.
  • Change the test workflow task from testGithubDebugUnitTest to testGithubReleaseUnitTest, because the release variant is the tested one under AGP 9.

Testing

  • Ran ./gradlew testGithubReleaseUnitTest: 13 tests, 0 failures, 0 errors.
  • Ran ./gradlew assembleGithubRelease: the release APK builds with the expected file name.
  • Ran ./gradlew tasks: the task list loads.
  • Checked the configuration phase with ./gradlew :app:help: exit code 0.
  • All checks ran locally on JDK 25 with a 2.5 GB JVM heap. gradle.properties still requests an 8 GB heap, which the local host cannot provide.
  • Not run: the GitHub Actions workflows.
  • Not run: the APK on a device or emulator. The Dagger and Kotlin bumps change runtime dependencies.
  • Known warning: AGP 9 reports that android.enableR8.fullMode=false will be removed in AGP 10. This change keeps the setting.

- Set CI JDK to 25 in build and test workflows
- Bump AGP to 9.5.1, Kotlin to 2.2.21 and KSP to 2.3.14
- Bump Gradle wrapper to 9.9.1 and regenerate gradlew scripts
- Bump Dagger to 2.60.1 and Mockito to 5.24.0
- Remove the kotlin-android plugin and set Kotlin options via compilerOptions
- Replace applicationVariants API with androidComponents for APK naming
- Enable unit test Android resources for AGP 9.5 Compose Preview tasks
@TonyRL TonyRL closed this Nov 17, 2026
@TonyRL
TonyRL deleted the chore/java-25-gradle-9 branch November 17, 2026 19:04
@TonyRL
TonyRL restored the chore/java-25-gradle-9 branch November 17, 2026 19:04
@TonyRL
TonyRL deleted the chore/java-25-gradle-9 branch November 17, 2026 19:04
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