Unsupported class file major version (Gradle / Java) Flutter / Dart Origin: On your device Last updated 4 Nov 2026

Android Gradle: Execution failed — Unsupported class file major version 65 / Android Gradle plugin requires Java 17 to run

Gradle or the Android Gradle plugin is running on a Java version it does not support.

Exact message you may see Unsupported class file major version 65Unsupported class file major version 61Android Gradle plugin requires Java 17 to run. You are currently using Java 11Could not resolve all files for configuration ':classpath' Java versionYour project's Gradle version is incompatible with the Java version
Seen on: Flutter Android Java

Meaning

Class version 65 = Java 21, 61 = Java 17, 55 = Java 11. Match the JDK to the Gradle/AGP versions: AGP 8.x needs JDK 17. Set JAVA_HOME (or flutter config --jdk-dir) to JDK 17, or upgrade Gradle to support the newer JDK.

Common causes

  • JDK too new for the Gradle version
  • JDK too old for AGP 8 (needs 17)
  • Multiple JDKs and wrong JAVA_HOME
  • Android Studio's bundled JDK vs system JDK differences
  • gradle-wrapper.properties pointing to an old Gradle

⚡ Quick fix

  1. flutter config --jdk-dir <path-to-jdk17>
  2. Upgrade Gradle wrapper to a version supporting your JDK
  3. Set JAVA_HOME and re-run flutter doctor -v

Detailed fix by platform

Flutter

  1. flutter config --jdk-dir "/Applications/Android Studio.app/Contents/jbr/Contents/Home"

How to diagnose

  1. Class version — Which Java?
  2. Gradle — Wrapper version?
  3. JAVA_HOME — Correct?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Android license status unknown / licenses not accepted — flutter doctor: Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses (Flutter / Dart)Android license statu…Android resource linking failed — AAPT: error: resource x (aka y) not found — Android resource linking failed (Android)Android resource link…android:attr/lStar not found — AAPT: error: resource android:attr/lStar not found (Android)android:attr/lStar no…Cannot fit requested classes in a single dex file — Cannot fit requested classes in a single dex file (# methods: 65536 > 65536) — mergeDex failed (Android)Cannot fit requested …Cleartext HTTP traffic not permitted — Flutter (Android): java.io.IOException: Cleartext HTTP traffic to api.example.com not permitted (Flutter / Dart)Cleartext HTTP traffi…cmdline-tools component is missing — flutter doctor: Android SDK is missing command-line tools; download from https://goo.gl/XxQghQ — cmdline-tools component is missing (Flutter / Dart)cmdline-tools compone…Could not resolve — Gradle: Could not resolve all files for configuration / Could not resolve dependency (Android)Could not resolveDependency requires compileSdk — Dependency 'androidx.x:1.y' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs (Android)Dependency requires c…Unsupport…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.