Could not open settings generic class cache for settings file '

48,269

Solution 1

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

Solution 2

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

Solution 3

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

Solution 4

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

Solution 5

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.

Share:
48,269

Related videos on Youtube

lorandsouza
Author by

lorandsouza

Updated on July 09, 2022

Comments

  • lorandsouza
    lorandsouza almost 2 years

    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

    • Sisir
      Sisir about 3 years
      Can you do a ./gradlew clean and then open android studio and resync your gradle
    • Einliterflasche
      Einliterflasche almost 3 years
      @Sisir Where do I have to execute the command? In the IDE terminal didn't work for me.
    • Sisir
      Sisir almost 3 years
      The gradlew file is present inside your android folder. So open a cmd, navigate to ProjectRoot\android and then execute teh command
    • Einliterflasche
      Einliterflasche almost 3 years
      @Sisir gradlew clean and gradlew throws the same error Could not open settings generic class cache for settings file
    • asish
      asish over 2 years
      setting java_home fixed error for me, org.gradle.java.home=/Applications/Android Studio 4.1 Preview.app/Contents/jre/Contents/Home
  • Einliterflasche
    Einliterflasche almost 3 years
    This didn't work for me. Where do I have to select the java edition?
  • Leonardo Costa
    Leonardo Costa almost 3 years
    It worked for me, I had the jkd 16 installed, so I installed the jdk 8 and worked. The Google needs free itself from all that envolves the java. It's so boring setuping all. Tks man!
  • Smart Manoj
    Smart Manoj almost 3 years
    @vishal Do you mean JDK 16?
  • 13Tracso
    13Tracso over 2 years
    @Sana'aAl-ahdal I am glad it did Enjoy your coding buddy.
  • Tony Lucas
    Tony Lucas over 2 years
    thanks bro, life saver, and I want to point out that this website: mkyong.com/java/…" shows a way to deal with JAVA_HOME if you needed.
  • tingwai
    tingwai about 2 years
    gradle-7.4 for JDK 17
  • Bradley Kirkland
    Bradley Kirkland about 2 years
    When providing support it's always better to provide more detailed instructions + AVAST is unlikely to have an issue as it's not been specified to be used by the stackoverflower