Skip to content

Modernize Gradle build to AGP 9.1 / Kotlin 2.4#64

Merged
MartinaeyNL merged 1 commit into
mainfrom
chore/modernize-gradle-agp
Jul 22, 2026
Merged

Modernize Gradle build to AGP 9.1 / Kotlin 2.4#64
MartinaeyNL merged 1 commit into
mainfrom
chore/modernize-gradle-agp

Conversation

@Miggets7

@Miggets7 Miggets7 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Closes #63.

What

Update the Gradle build to current stable versions.

  • AGP 8.9.1 → 9.1.1, Kotlin 2.1.20 → 2.4.10, Gradle wrapper 9.2.1 → 9.6.1
  • AndroidX, Firebase (BoM 34.16.0), protobuf 4.35.1, coroutines 1.11.0 bumped
  • compileSdk/targetSdk 35 → 36

AGP 9 forced changes

AGP 9 hard-errors without these:

  • Removed the kotlin-android plugin — Kotlin is built in now.
  • kotlinOptions → top-level kotlin { compilerOptions } DSL (kotlinOptions was removed in Kotlin 2.2).
  • Declared buildConfig / resValues build features explicitly — AGP 9 flips their defaults off.
  • firebase-messaging-ktxfirebase-messaging (ktx merged into the base artifact in BoM 34.x).
  • protobuf module: dropped the redundant sourceSets block — plugin 0.10.0 rejects it as a duplicate proto entry.

Notes

  • jackson-module-kotlin pinned strictly to 2.19.4: 2.20+ emits value-class MethodHandle bytecode that D8 rejects below minSdk 26, and this project is minSdk 25. strictly makes a transitive bump fail loudly instead of silently breaking dexing.
  • Removed the empty GenericApp/build.gradle marker and the dead package attribute in ORLib's manifest.

Verification

./gradlew clean assemble passes, release variants included.

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.
@Miggets7
Miggets7 requested a review from a team July 22, 2026 12:13

@MartinaeyNL MartinaeyNL left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Miggets7

Copy link
Copy Markdown
Contributor Author

@MartinaeyNL Well, it compiles and runs on my device. Setting up CI/CD would be a separate issue I guess

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread gradlew.bat
Comment thread gradlew.bat
@Miggets7

Miggets7 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Both verified:

Compiles — CI passed on this PR (run); local ./gradlew clean assemble green too.

Downstream — resolved the updated lib from a real consumer app (reschool): clean, no conflicts. The protobuf 4.35.1 bump upgrades transparently, and the firebase-messaging-ktx workaround is no longer needed.

@Miggets7
Miggets7 requested a review from MartinaeyNL July 22, 2026 12:48

@MartinaeyNL MartinaeyNL left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MartinaeyNL
MartinaeyNL merged commit 8531435 into main Jul 22, 2026
2 checks passed
@Miggets7
Miggets7 deleted the chore/modernize-gradle-agp branch July 22, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update code to use Android API 36

3 participants