Hello im using Gradle 8.0 and java 19 and i get the following error when i try to run it in eclipse
FAILURE: Build failed with an exception.
What went wrong:
Could not open cp_init generic class cache for initialization script ‘C:\Users\stich\eclipse-workspace.metadata.plugins\org.eclipse.buildship.core\init.d\eclipsePlugin.gradle’ (C:\Users\stich.gradle\caches\7.5.1\scripts\7fciaz2tzo3lxxw75zggl661a).
BUG! exception in phase ‘semantic analysis’ in source unit ‘BuildScript’ Unsupported class file major version 63
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
As you can see in the cache directory in your error message, you are not using Gradle 8, but Gradle 7.5.1.
That is not supported to run on Java 19.
And “Unsupported class file major version 63” means, that you want to use something that is compiled for Java 19+ while using Java -18.
You should not download and install any Gradle version usually.
You should use the Gradle wrapper.
And I guess you installed Gradle 8, but correctly use the wrapper to run the build.
The wrapper makes sure that there are no version incompatibilites, so that a build does not behave differently if run with different Gradle versions, as you define in the wrapper the exact version to use for the build.
Hello sir please help me everytime I run my flutter project I get this error I’m struggling How can I use the Gradle wrapper to solve this problem I’m confused
Thank you
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\ayoub\StudioProjects\app1\android\settings.gradle' (C:\Users\ayoub\.gradle\caches\7.5\scripts\3d075fs9hjp81ny0sgym4v09w).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63
* 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 6s
I don’t know what more to say than I already said above.
Don’t try to run Gradle 7.5 on Java 19 and don’t use Java 19 compiled things when using Java -18.
I do neither Android development nor do I use Flutter, so no idea what might be special there.
You gotta do what Björn Kautler said. U are using a gradle version that does not support the java version u are using. Either downgrade to java 18 or download gradle 8.0 which support java 19