Skip to content

Android build fails on current Gradle, JDK and AGP #41

Description

@developerjamiu

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginfraBuild, CI, tooling, testsplatform: androidAffects the Android implementation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions