my case, on Windows 10, my JAVA_HOME was set to
JAVA SE 16 C:\Program Files\Java\jdk-16 and when I looked at the
release file in java jre in android studio, C:\Program Files\Android\Android Studio\jre\release, I found that the the JAVA_VERSION WAS "11.0.10" (java 11) for short. So I
changed the java installation on my PC to Java 11, update JAVA_HOME in my environment variables to point to the new java (C:\Program Files\Java\jdk-11.0.12) and
restarted android studio, Then everything worked.
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.
should be working fine.
C:\Program Files\Android\Android Studio\jre
Gradle "Could not open buildscript class cache"
go to location ".gradle\caches\2.0\scripts\build_7l4t45nbnsvdcl79ol8u0beli4\ProjectScript" and remove cache.properties.lock file
rm -rf ~/.gradle/caches