Skip to content

build(android): support AGP 9.5.1, Gradle 9.9.0 and Kotlin 2.4.21 - #4

Merged
dballance merged 3 commits into
masterfrom
chore/agp-9.5-toolchain
Nov 9, 2026
Merged

dballance merged 3 commits into
masterfrom
chore/agp-9.5-toolchain

Conversation

@tango-tango-mashbill

Copy link
Copy Markdown

Pull request opened by mashbill for dballance from a mashbill Session.


Why

On AGP 9.2 and later, apps fail while they configure :reactive_ble_mobile with ProtoSourceSet with name 'debug' not found. The cause is protobuf-gradle-plugin:0.9.4 on the plugin's buildscript classpath, because it hooks the legacy variant API. Shine works around this today with id "com.google.protobuf" version "0.10.1" apply false in its settings.gradle. Once this PR is merged, Shine can drop that workaround.

Changes

packages/reactive_ble_mobile/android/build.gradle:

  • protobuf-gradle-plugin: 0.9.4 → 0.10.1. 0.10.0 added AGP 9 support, and 0.10.1 removes the Configuration.setVisible calls that Gradle 9.8 deprecates. Neither release changes the DSL used here (protobuf {} or android.sourceSets.main.proto).
  • AGP: 9.1.0 → 9.5.1.
  • Kotlin: 2.4.10 → 2.4.21. KGP is still only on the classpath, and kotlin-android is not applied, so built-in Kotlin works.
  • android-junit5: 1.11.2.0 → 2.0.2. 1.x uses the legacy variant API. In 2.x the plugin id is de.mannodermaus.android-junit.
  • detekt: 1.23.0 → 1.23.8. 1.23.0 fails on JDK 21 with Invalid value (21) passed to --jvm-target. The deprecated input property becomes source.
  • Groovy DSL: properties now use = assignment, because the space-assignment form is deprecated and will be removed in Gradle 10.

ReactiveBleClient.kt: I wrapped one lambda-type parameter list that detekt-formatting 1.23.8 flags (ParameterListWrapping). This is formatting only, with no behaviour change.

example/android: AGP 9.5.1, Kotlin 2.4.21, Gradle wrapper 9.3.1 → 9.9.0, and android.builtInKotlin=true.

The Dart API and the protobuf schema are unchanged.

Verification

Run locally on Flutter 3.47.9 and OpenJDK 21:

  • flutter build apk --debug in example/ succeeds.
  • ./gradlew :reactive_ble_mobile:testDebugUnitTest passes: 66 tests, 0 failures.
  • ./gradlew :reactive_ble_mobile:detekt passes.
  • The protobuf classes are generated (generated/java/generateDebugProto/.../ProtobufModel.java) and compiled into ProtobufModel$*.class.

Notes

  • CI (.github/workflows/main.yml) still pins Flutter 3.44.0. The GitHub App can't change workflow files, so someone has to bump it to 3.47.9 separately.
  • With android.newDsl=true, the example fails inside Flutter's own flutter-gradle-plugin (ClassCastException to AbstractAppExtension). This doesn't come from this plugin, so the example keeps newDsl=false.

- protobuf-gradle-plugin 0.9.4 -> 0.10.1 (AGP 9 support; fixes
  'ProtoSourceSet with name debug not found' on AGP 9.2+)
- AGP 9.1.0 -> 9.5.1, Kotlin 2.4.10 -> 2.4.21
- android-junit5 1.11.2.0 -> 2.0.2 (plugin id is now
  de.mannodermaus.android-junit; 1.x uses the legacy variant API)
- detekt 1.23.0 -> 1.23.8 (1.23.0 fails on JDK 21); use source
  instead of the deprecated input property
- use '=' assignment in build.gradle (Gradle 10 deprecation)
- wrap a lambda parameter list flagged by detekt-formatting 1.23.8
- example: AGP 9.5.1, Kotlin 2.4.21, Gradle 9.9.0, builtInKotlin=true

Co-authored-by: dballance <1234523+dballance@users.noreply.github.com>
tango-tango-mashbill Bot and others added 2 commits November 9, 2026 21:14
Co-authored-by: dballance <1234523+dballance@users.noreply.github.com>
Flutter 3.44's Gradle plugin applies kotlin-android to plugin projects,
which AGP 9 rejects when android.builtInKotlin=true. 3.47.9 does not.
@dballance
dballance marked this pull request as ready for review November 9, 2026 21:18
@dballance
dballance merged commit 472fc57 into master Nov 9, 2026
2 checks 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