Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not open settings generic class cache for settings file '

I reinstalled my android studio since the sdk was not found and so on. After re installing java jdk and android studio , everything worked well until I got an error saying 'Could not initialize class org.codehaus.groovy.runtime.InvokerHelper' which I solved by changing the Gradle version. And now the error is 'Type 'FlutterTask' property 'assets' is missing an input or output annotation.'

FAILURE: Build failed with an exception.

  • What went wrong: Could not open settings generic class cache for settings file 'C:\Users\loran\ASProjects\xylophone-flutter\android\settings.gradle' (C:\Users\loran.gradle\caches\6.8.2\scripts\4mawlyb2l5e9tefyvnpxva1kg).

BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 60

  • 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 46s Exception: Gradle task assembleDebug failed with exit code 1

like image 867
lorandsouza Avatar asked Apr 24 '21 07:04

lorandsouza


People also ask

How do you fix could not open settings generic class cache for settings file?

To Solve Could not open settings generic class cache for settings file Error If You are using java 12, 13 Or Any Version execpt Java 8 Then You just have to unistall java and reinstall java 8 version. By using java 8 will solve this error.


8 Answers

I also had this problem So I did install java 8 You might have Java 13 So install Java 8

like image 196
Vishal Adhithya Avatar answered Oct 22 '22 13:10

Vishal Adhithya


Java JDK 16 is the one that seems to lead to this issue try downgrading by downloading a lower version of JDK preferable JDK 8 or 11

To future individuals who will run to this error. Here is the link to download the JDK enjoy your coding experience don't forget to change the path too. https://www.oracle.com/java/technologies/javase-downloads.html

like image 33
13Tracso Avatar answered Oct 22 '22 11:10

13Tracso


mainly you have jdk16 i tried to install java 8 and set env to java 8 it worked for me

like image 4
Noura Abdelnoor Avatar answered Oct 22 '22 11:10

Noura Abdelnoor


Try installing the latest Gradle package gradle-7.1.1, if you are using Java JDK 16 installed. To do this open android/gradle/wrapper/gradle-wrapper.properties file and under distribution url, update the gradle version to 7.1.1 (or the latest). After that, inside your Flutter project directory, run the following command in the terminal:

cd android && ./gradlew
like image 3
Anmol Tiwari Avatar answered Oct 22 '22 12:10

Anmol Tiwari


If this error occurs, this might because you have installed the latest JDK such as JDK 16. You download and install JDK 8 and uninstall JDK 16. Then restart the desktop/laptop and try launch and run flutter run again. It should be working fine.

like image 1
Eric Avatar answered Oct 22 '22 13:10

Eric


I removed the JAVA_HOME path to the JAVA download and changed JAVA_HOME path to the following:

C:\Program Files\Android\Android Studio\jre

I am now coding

like image 1
Joseph DeWeese Avatar answered Oct 22 '22 12:10

Joseph DeWeese


I GOT IT. No need no change your JDK version, follow the steps to resolve the issue:

  • check your java version and remember it, use "java -version" in terminal
  • go to your android studio path installation
  • then in: Android Studio/jre/ open the file named "release"
  • take attention of the value of JAVA_VERSION field
  • if it's not the same as the java version on your computer, just change it with the version installed on your computer.

That's it, i hope it will resolve your issue like it resolve mine.

Try it and give a feedback.

like image 1
fragg112 Avatar answered Oct 22 '22 11:10

fragg112


Try this! Remove package android from the top of settings.gradle. This helped me out.

like image 1
Mahdi Bagheri Avatar answered Oct 22 '22 13:10

Mahdi Bagheri