'Flutter build error for the first time :Could not open settings remapped class cache for 7yvt6la2007dno98lt3rzbguf
I just downloaded Flutter and tried to learn the emulator with the first default code which Google offered. But it does not run at all!
I have the dart and flutter plugins installed. I also changed the order of jcenter() and google() too
like this:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
google()
}
}
And the error is:
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 remapped class cache for 7yvt6la2007dno98lt3rzbguf (/Users/[myname]/.gradle/caches/5.6.2/scripts-remapped/settings_7iv4l88jiyzeatj2wku74hwcv/7yvt6la2007dno98lt3rzbguf/settings8410a2d21ed2f87c8a0398566330ee52).
> Could not open settings generic class cache for settings file '/Users/[myname]/AndroidStudioProjects/test_app/android/settings.gradle' (/Users/[myname]/.gradle/caches/5.6.2/scripts/7yvt6la2007dno98lt3rzbguf/settings/settings8410a2d21ed2f87c8a0398566330ee52).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 57
* 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 568ms
Finished with error: Gradle task assembleDebug failed with exit code 1
Solution 1:[1]
I got it! My current java version was 12 and I downgraded it to Java 8. Then everything works fine.
I'll leave it, hoping it can help somebody struggling in the future will
Solution 2:[2]
You need to update version of Gradle:
- go to https://gradle.org/install/ and get info about last version (for now it is 7.1.1)
- open gradle/wrapper/gradle-wrapper.properties and change version to last
distributionUrl=https://services.gradle.org/distributions/gradle-7.1.1-all.zip
Solution 3:[3]
I don't know reason for this error. But I was updated gradle version to the latest in gradle-wrapper.properties file. Then sync. It worked for me.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
Solution 4:[4]
I had the same issue with a slightly different error message:
... Could not open settings remapped class cache for 3n8ygcxrc7nelqcw5tzib8bo6....
I was able to resolve this issue by opening the android folder in my project with Android Studio and syncing Gradle. Here's how:
Let's say that my current Flutter project is in the directory C:\Users\Mendel\Documents\Flutter Projects\test.
In this directory, there's an android folder, open this android folder in Android Studio instead of your current Flutter project, (goto File -> Open) and let Gradle Sync run (it will run automatically, the process will take some time). Once done, re-open your Flutter project.
Solution 5:[5]
I had the same issue: For fixing install openJdk8 version https://adoptopenjdk.net/upstream.html?variant=openjdk11&jvmVariant=openjdk8 Also, change the path to OpenJDK place
Solution 6:[6]
In other, for me to solve this issue,
- I had to open my project in finder and then
- Dragged the android folder onto Android Studio. It will start from afresh to resync my project with all neccessary conflicting gradle versions and jdk's .
Note while the syncing was going on, I made sure to accept every upgrade recommendation brought up on the dialog until the process was completed.
When this was done, I went back to my project, ran it again and it worked smoothly.
Solution 7:[7]
Try to uninstall java, restart android studio and run the application again. Grandle handled everything by itself.
Solution 8:[8]
Since Android Studio comes bundled with JDK, it may be a solution to downgrade (or upgrade?) your Android Studio version.
For example, if you are still using Flutter 1.x, I recommend using Android Studio up to 4.2.x. This requires no additional installations or configuration changes, whereas later versions cause all sorts of weird issues.
Solution 9:[9]
Delete the .gradle file and then run ./gradlew clean
Solution 10:[10]
i have the same issue i have java 17 installed in my system
after searching this on internet i found that if you downgrade your java from whatever to java 8 or java 11 then it's going to work.
i downgrade to java 11 and its works
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow


