FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file '/home/lenovo/Desktop/React Native /project_2/android/settings.gradle' (/home/lenovo/.gradle/caches/8.6/scripts/5sa9oh58krr7nvke7jztsd1z7).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66
* 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 818ms
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong:
Could not open settings generic class cache for settings file '/home/lenovo/Desktop/React Native /project_2/android/settings.gradle' (/home/lenovo/.gradle/caches/8.6/scripts/5sa9oh58krr7nvke7jztsd1z7).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66 * 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 818ms.
info Run CLI with --verbose flag for more details.
Is there a question hidden somewhere?
Hey there
I was following the initial tutorial and faced the same error message as shown in the first post of the topic.
Gradle seems to be installed correctly : the command gradle -v returns the version 8.10.2
Gradle is in the PATH
Java_Home is in the PATH
JDK is 23
The error message occurs when you run the following command :
./gradlew bootRun
Already tried some commands as :
rm -rf C:\Users{myuser}.gradle\caches
gradle clean
But the error is still here.
I am currently with the gradle-8.3-bin.zip, tried the gradle-7.6-bin.zip version but still has the error.
Regards,
What gradle -v
returns is irrelevant.
It is even irrelevant whether you have any gradle
in your PATH or not.
Any sane project has the four Gradle wrapper files that define for which version of Gradle a build is designed and known working with, and the wrapper takes care to use exactly that Gradle version to run the build.
In your case it is 8.3 (or 7.6) and those are not compatible to be run with Java 23 for which you need at least Gradle 8.10, as per Compatibility Matrix.
So either upgrade your build to use a newer Gradle version that is compatible with the Java version you want it to run with, or use an older Java version that is compatible to run the Gradle version you are using.
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\Hp\S_eshop_Admin_App-v4.4.0\android\settings.gradle' (C:\Users\Hp\.gradle\caches\7.6\scripts\181f8ztwffnirbvka8qh2s66o).
> 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 28s
Running Gradle task 'assembleDebug'... 30.2s
ββ 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 C:\Users\Hp\S_eshop_Admin_App-v4.4.0\android\gradle\wrapper\gradle-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
hi sir this is the problem im facing in my project it is an completed project but when i download it in my android studio the project show this error but i check the compatability of the version of java and gradle it all same but i didnβt get a solution pls help me to solve it
I donβt really get what you are saying.
Your error contains exactly the problem and a link with further information.
You are using Java 21 to run a Gradle 7.6 build and that is not supported.
the problem is that i am using the java version 19 in this project but it takes java version 21 which is i installed before java version 19 .when i run the project with java version 21 it shows version not support after that i uninstalled java version 21 and check the correct java version for gradle 7.6 and installed the correct version 19 after installation i set the path in environment variable for java version 19 after these process i run the project in vscode but they detect the java version 21 which in uninstalled not the java version 19. when i run java --version in terminal it shows version 19 but when i run flutter doctor --verbose it show the version of java21 .
Well, I can hardly guess what you did wrong where on your computer.
Flutter only gives you a helpful explanation.
Gradle tells you already that you are using Java 21 to run a Gradle 7.6 build.
So it seems you did not uninstall Java 21, at least not properly.
But I really cannot guess the situation on your local box beyond that.