Modernize Gradle build to AGP 9.1 / Kotlin 2.4#64
Conversation
Bump AGP to 9.1.1, Kotlin to 2.4.10, and the Gradle wrapper to 9.6.1, and
update the AndroidX, Firebase, protobuf, and coroutines dependencies to
current versions. Set compileSdk/targetSdk to 36.
Apply the migrations AGP 9 requires: remove the kotlin-android plugin (Kotlin
is now built in), move kotlinOptions to the kotlin{} compilerOptions DSL,
declare the buildConfig and resValues build features explicitly, and replace
firebase-messaging-ktx with firebase-messaging (the ktx artifact merged into
the base one). Drop the redundant sourceSets block in the protobuf module,
which the 0.10.0 plugin rejects as a duplicate proto entry.
Pin jackson-module-kotlin strictly to 2.19.4: 2.20+ emits value-class
MethodHandle bytecode that D8 rejects below minSdk 26, and this project is
minSdk 25. Remove the empty GenericApp/build.gradle marker and the dead
package attribute in ORLib's manifest.
MartinaeyNL
left a comment
There was a problem hiding this comment.
Thanks for the PR!
Is there any way for us to check whether it compiles OK or not?
As we don't have a CI/CD, if you can share anything would be great.
I don't know if we can verify breaking changes in child dependencies like protobuf ?
It would be pity to update the Android lib, but turns out it is broken when used in custom projects.
|
@MartinaeyNL Well, it compiles and runs on my device. Setting up CI/CD would be a separate issue I guess |
There was a problem hiding this comment.
Pull request overview
Modernizes the project’s Gradle/Android build tooling to support targeting Android API 36 and align with newer AGP/Kotlin/Gradle requirements, including associated dependency and DSL updates.
Changes:
- Upgraded build toolchain (AGP 9.1.1, Kotlin 2.4.10, Gradle wrapper 9.6.1) and moved compile/target SDK to 36.
- Migrated Kotlin/AGP configuration to the newer DSL (e.g.,
kotlin { compilerOptions }) and explicitly enabled build features now defaulted off in AGP 9. - Bumped key dependencies (AndroidX, Firebase BoM, protobuf, coroutines) and simplified protobuf module config.
Reviewed changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| protobuf/build.gradle | Updates protobuf toolchain versions and Java compatibility to 17; removes now-redundant/invalid source set config. |
| ORLib/src/main/AndroidManifest.xml | Removes deprecated package attribute in favor of Gradle namespace. |
| ORLib/build.gradle | Updates Android SDK levels, dependencies, build features, and Kotlin compiler options DSL. |
| gradlew.bat | Updates Windows wrapper script for the new Gradle wrapper version (but currently has a control-flow bug on failure paths). |
| gradlew | Updates POSIX wrapper script header/link to match new wrapper template. |
| gradle/wrapper/gradle-wrapper.properties | Updates Gradle distribution to 9.6.1 and adds wrapper download retry settings. |
| gradle.properties | Removes Jetifier and deprecated default build feature flag. |
| GenericApp/build.gradle | Removes the empty marker build file. |
| GenericApp/app/build.gradle | Updates Android SDK levels, dependencies, build features, Kotlin compiler options DSL, and task registration. |
| build.gradle | Updates Kotlin/AGP/Google Services/protobuf plugin versions and modernizes task registration for clean. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Both verified: Compiles — CI passed on this PR (run); local Downstream — resolved the updated lib from a real consumer app ( |
MartinaeyNL
left a comment
There was a problem hiding this comment.
Sure, let's merge this, create a patch release for orlib, and test it in custom projects.
This package is mostly for internal use anyway, so we can always revert or unpublish if this broke the apps.
Closes #63.
What
Update the Gradle build to current stable versions.
AGP 9 forced changes
AGP 9 hard-errors without these:
kotlin-androidplugin — Kotlin is built in now.kotlinOptions→ top-levelkotlin { compilerOptions }DSL (kotlinOptionswas removed in Kotlin 2.2).buildConfig/resValuesbuild features explicitly — AGP 9 flips their defaults off.firebase-messaging-ktx→firebase-messaging(ktx merged into the base artifact in BoM 34.x).sourceSetsblock — plugin 0.10.0 rejects it as a duplicate proto entry.Notes
jackson-module-kotlinpinned strictly to 2.19.4: 2.20+ emits value-classMethodHandlebytecode that D8 rejects below minSdk 26, and this project is minSdk 25.strictlymakes a transitive bump fail loudly instead of silently breaking dexing.GenericApp/build.gradlemarker and the deadpackageattribute in ORLib's manifest.Verification
./gradlew clean assemblepasses, release variants included.