Getting class cache errors when building with Gradle

1,518

Turns out it doesn't work with Java 13 (didn't work on Java 11 either). Had to point to Java 8 instead after which I ended up with errors saying I needed to accept licenses.

Go to the location of your Android SDK and run following command to accept licenses.

tools/bin/sdkmanager --licenses

That would do the trick, at least it did for the above issue.

Share:
1,518
kar
Author by

kar

13 years experience in the marine and shipping field mainly related to electronics engineering . Switched field and started fresh to pursue an interest in programming and currently working as a Software Engineer in casino gaming sector.

Updated on December 16, 2022

Comments

  • kar
    kar over 1 year

    Trying to start the default Flutter project (the one with the counter). (I was able to do this fine in an old laptop. This is a new machine (Windows) and new setup double checked and all same settings. Not really relevant I suppose but my other Java / Maven stuff all works fine in this machine).

    Getting following error:

    FAILURE: Build failed with an exception.

    • What went wrong: Could not open settings remapped class cache for 3gvp67rxesfd2nfkbvtuzjg3o (C:\Users\abc.gradle\caches\5.6.2\scripts-remapped\settings_eqlrh24ro2w01smdn4qy7bdm6\3gvp67rxesfd2nfkbvtuzjg3o\settings8410a2d21ed2f87c8a0398566330ee52).

      Could not open settings generic class cache for settings file 'C:\Users\abc\dev\flutter\myapp\android\settings.gradle' (C:\Users\abc.gradle\caches\5.6.2\scripts\3gvp67rxesfd2nfkbvtuzjg3o\settings\settings8410a2d21ed2f87c8a0398566330ee52). BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 57

    Using Geny motion and the Android SDK version is Q (v29). I have tried the project language level for Android to 8, 11 and 13 and all throws same error.

    Seen similar issues here and been told to clear gradle cache. Done it at following locations:

    C:\Users\abc.gradle (there is a cache folder inside here and deleted that entire folder)

    and inside the Flutter project

    myapp\android.gradle (there was a cache folder inside here and deleted it. There is another folder called 5.6.2 which I didn't touch) .

    I am using Intellij Ultimate. The moment I run it, these folders gets regenerated with the relevant cache stuff and throws same. Does anyone knows how to fix this please?

    It is a brand new project and using all latest sdks (android, flutter). Please advice. Thanks.