I am trying to accept flutter doctor –android-licenses but I am getting this error:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
7
Answers
UPDATE
It turns out there are 2 JDK installed in my environment, you can check by using
so after removing the older JDK version, the issue is fixed.
Having the same error, although here is my
java --version
outputthis happens after I upgrade to flutter 3.7.1
I’ve had the same error, I haven’t specify JAVA_HOME env, and flutter used my 1.8 java.
For macOS:
Check your JAVA_HOME env
in terminal with
if env not existed, list installed java version
choose one and execute
You can run the following command to see if you have multiple java versions:
In my case, I had 2 versions on my mac: java 8 and java 19. I followed the official java website to remove my older version:
I’m on MacOS Ventura. I installed Android Studio today. This is how I solved the problem:
cd /Applications/Android Studio.app/Contents/jbr
ln -s ../jbr jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
flutter doctor
againflutter doctor --android-licenses
.I was able to agree to the licenses successfully after.
All the steps are also mentioned here and here
Try This (For Windows)
“C:UsersUSERNAMEAppDataLocalAndroidSdkcmdline-tools”
and rename the 8.0 folder to “latest”
There is a simple way to resolve this issue.
The problem seems to be when the android studio installed is Android Studio Electric Eel
All you have to do is: