I’m trying to install Flutter and can’t seem to get through the part of accepting the Android licenses in flutter doctor. I keep getting this error when I try to run ‘flutter doctor –android-licenses’ in the command prompt.
C:Usersanach>flutter doctor --android-licenses
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
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" Android sdkmanager tool was found, but failed to run (C:UsersanachAppDataLocalAndroidsdkcmdline-toolslatestbinsdkmanager.bat):
"exited code 1".
Try re-installing or updating your Android SDK,
visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.
I’ve tried almost every solution including manually downloading the Android SDK Tools in Android Studio’s SDK Manager but I still get the same error. I’ve read that people are experiencing the same problems when updating to Android Studio Electric Eel. Does anyone know how to resolve this?
2
Answers
Have you checked if you have the Android SDK Command-Line Tools installed, you can check it in Android Studio under Appearance and Behavior > System Settings > Android SDK.
Android Studio
Put this licenses folder in your Android SDK root License folder and then restart your IDE