I am getting this error after updating. like android studio i am using is latest, java JDK id 17 then after this i am changing it in 11 but still not able the correct Gradle version.
please suggest the idea like correct Gradle version which i have to use for my project.
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'D:FluttersuprbFlutersaveCodefluterandroidsettings.gradle' (C:Userssonal.gradlecaches8.1.1scriptsernrjmhpn64ovli3a1sz8s5gv).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 32s
┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project's Gradle version is incompatible with the Java version that Flutter is using │
│ for Gradle. │
│ │
│ If you recently upgraded Android Studio, consult the migration guide at │
│ https://flutter.dev/to/to/java-gradle-incompatibility. │
│ │
│ Otherwise, to fix this issue, first, check the Java version used by Flutter by running `flutter │
│ doctor --verbose`. │
│ │
│ Then, update the Gradle version specified in │
│ D:FluttersuprbFlutersaveCodefluterandroidgradlewrappergradle-wrapper.properties to be │
│ compatible with that Java version. See the link below for more information on compatible │
│ Java/Gradle versions: │
│ https://docs.gradle.org/current/userguide/compatibility.html#java │
│ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1
2
Answers
I’ve also faced this issue for the past 2 or 3 days, but I found the solution. The problem is that you downloaded the latest version of Android Studio, which is not compatible. You need to download an older version of Android Studio.
This issue may occur due to compatibility problems with the version of Android Studio you’re using. I recommend upgrading to:
Android Studio Jellyfish | 2023.3.1 RC 1
Build #AI-233.14808.21.2331.11643467, built on March 29, 2024
This version includes updates to the Gradle plugin and build system that address many issues like the one mentioned.
Here are the relevant details for the recommended version:
Runtime Version: 17.0.10+0–11572160 (OpenJDK 64-Bit Server VM by JetBrains s.r.o.)
Operating System: Windows 11.0
Plugins:
Dart (233.15271)
Flutter (82.1.1)
You can download this version from the official Android Studio website under the preview or stable releases section. Upgrading should resolve the error you’re facing.