Repository navigation
Description
Use case
Flutter Android builds currently fail when using JDK 25, even though Gradle 9.1+ officially supports Java 25. The Android Gradle Plugin (AGP) is validated against Java 17 and partially Java 21, but not Java 25. This mismatch prevents developers from adopting the latest JDK in Flutter projects.
Problem: Builds break with native access errors and unsupported class versions when running Flutter with Java 25.
Alternatives considered:
Using JDK 17 or JDK 21 (stable but limits forward compatibility).
Forcing bytecode compatibility in build.gradle (partial workaround, still unstable).
Dual‑JDK setup (works but adds complexity).
No package on pub.dev currently solves this issue because it requires core Flutter + Gradle integration changes.
Proposal
Add official support for Java 25 in Flutter’s Android build tooling:
Validate Flutter’s Gradle + AGP integration against Java 25.
Update Flutter documentation to reflect compatibility once support is added.
Ensure flutter doctor recognizes Java 25 as a supported JDK.
Impact
Developers using Gradle 9.1+ cannot reliably build with Java 25 in Flutter.
Supporting Java 25 ensures forward compatibility, aligns Flutter with Gradle’s official matrix, and reduces friction for developers benchmarking workflows or adopting newer JDKs.
Environment Example
Flutter version: [your current Flutter version]
Gradle version: 9.1+
AGP version: 8.5.0
JDK version: 25.0.x
Activity
mbcorona commentedon May 28, 2026
Thanks for the report. Routing as a proposal to the Android team.
shawal-mba commentedon Jul 11, 2026
hmmm the pr was closed unmerged. Apparently flutter recommend java 21.
fatihdurmaz commentedon Aug 3, 2026
I temporarily changed the JDK path manually for Java 21, but we are waiting for support for version 25.
louisho5 commentedon Aug 7, 2026
For someone who want a temporary fix on macOS, you can install the JDK 21 manually or just
$ brew install openjdk@21.Then, just update the JDK path with
$ flutter config --jdk-dir="/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home".Done. You may also verify with
$ flutter doctor -v.christoph-linexo commentedon Aug 11, 2026
I changed my gradle daemon's jdk to the same jdk as the android project's. This was my fix. Do you see this as a viable option?
[LUPIN-MOBILE] Correct the claim that Android Studio bundles JDK 21, …
flutter-triage-bot commentedon Oct 6, 2026
This issue is assigned to @jesswrd but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!