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.
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 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
flutter config --jdk-dir <path-to-jdk17>- Upgrade Gradle wrapper to a version supporting your JDK
- Set JAVA_HOME and re-run
flutter doctor -v
Detailed fix by platform
Flutter
flutter config --jdk-dir "/Applications/Android Studio.app/Contents/jbr/Contents/Home"
How to diagnose
- Class version — Which Java?
- Gradle — Wrapper version?
- 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:
Similar errors
- Android license status unknown / licenses not accepted flutter doctor: Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses
- Android resource linking failed AAPT: error: resource x (aka y) not found — Android resource linking failed
- android:attr/lStar not found AAPT: error: resource android:attr/lStar not found
Most viewed in Flutter / Dart
- setState() called after dispose() Flutter: setState() called after dispose(): _MyState#1a2b3 (lifecycle state: defunct, not mounted)
- A RenderFlex overflowed Flutter: A RenderFlex overflowed by x pixels on the right/bottom
- Null check operator used on a null value Dart/Flutter: Null check operator used on a null value
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 4 Nov 2026