flutter build apk --debug in example/ fails on a current toolchain. Verified on Flutter 3.47.2 with JDK 21.0.7:
Gradle build failed due to Java/Gradle incompatibility.
The Java version used for the build is 21.0.7, which is incompatible with Gradle 8.3.
Flutter also emits a forward-compatibility warning in the same run:
[!] Starting AGP 9+, only the new DSL interface will be read.
This results in a build failure when applying the Flutter Gradle plugin at
.../example/android/app/build.gradle
Current versions in the repo against Flutter's present template:
|
This repo |
Flutter template |
| Gradle wrapper |
8.3 (example), 7.4 (plugin) |
current |
| Kotlin |
1.7.10 |
resolved per project |
| Android Gradle Plugin |
7.3.1 |
current |
| compileSdk |
33 |
36 |
| Java |
8 |
17 |
| Build script |
Groovy |
Kotlin DSL |
The hasProperty("namespace") guard in android/build.gradle is an AGP 4 workaround that has been unnecessary for years.
Consumer apps with their own modern Gradle setup still build against the published plugin, so this does not affect users directly. It does mean no maintainer or contributor can build, run or test the Android half, which is why this blocks the Android bug fixes.
Fix: regenerate the Android scaffolding for both the plugin and the example from the current Flutter template, porting across the two source sets and the coroutines dependency.
Found during the v0.4.0 codebase audit.
flutter build apk --debuginexample/fails on a current toolchain. Verified on Flutter 3.47.2 with JDK 21.0.7:Flutter also emits a forward-compatibility warning in the same run:
Current versions in the repo against Flutter's present template:
The
hasProperty("namespace")guard inandroid/build.gradleis an AGP 4 workaround that has been unnecessary for years.Consumer apps with their own modern Gradle setup still build against the published plugin, so this does not affect users directly. It does mean no maintainer or contributor can build, run or test the Android half, which is why this blocks the Android bug fixes.
Fix: regenerate the Android scaffolding for both the plugin and the example from the current Flutter template, porting across the two source sets and the coroutines dependency.
Found during the v0.4.0 codebase audit.