Skip to content

Java 25 Support in Flutter Android Builds #187223

Open

Description

@Krish5706

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

  1. added
    c: proposalA detailed proposal for a change to Flutter
    in triagePresently being triaged by the triage team
    platform-androidAndroid applications specifically
    toolAffects the "flutter" command-line tool. See also t: labels.
    t: gradle"flutter build" and "flutter run" on Android
    team-iosOwned by iOS platform team
    team-androidOwned by Android platform team
    and removed
    in triagePresently being triaged by the triage team
    team-iosOwned by iOS platform team
    on May 28, 2026
  2. mbcorona commented on May 28, 2026

    @mbcorona
    Member

    Thanks for the report. Routing as a proposal to the Android team.

  3. added
    triaged-androidTriaged by Android platform team
    P2Important issues not at the top of the work list
    on Jun 2, 2026
  4. shawal-mba commented on Jul 11, 2026

    @shawal-mba

    hmmm the pr was closed unmerged. Apparently flutter recommend java 21.

  5. fatihdurmaz commented on Aug 3, 2026

    @fatihdurmaz

    I temporarily changed the JDK path manually for Java 21, but we are waiting for support for version 25.

  6. louisho5 commented on Aug 7, 2026

    @louisho5

    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.

  7. christoph-linexo commented on Aug 11, 2026

    @christoph-linexo

    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?

  8. added
    ⏳Bot is counting down the days until it unassigns the issue
    on Oct 6, 2026
  9. flutter-triage-bot commented on Oct 6, 2026

    @flutter-triage-bot

    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!

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

Metadata

Metadata

Assignees

Labels

⏳Bot is counting down the days until it unassigns the issueP2Important issues not at the top of the work listc: proposalA detailed proposal for a change to Flutterplatform-androidAndroid applications specificallyt: gradle"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions