0

I was trying to install flutter sdk...I downloaded and installed it and ran the flutter doctor command. It had multiple errors and i was trying to solve those.. one of which was that flutter hadn't accepted android licenses and it required Android sdk cmndtools..after installing it i ran the command "flutter doctor --android-licenses" but it shows me JNI error [here after running the command it shows JNI error]

C:\Users\Acer>flutter doctor --android-licenses
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
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    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:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    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:650)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)

I tried to find a solution to this problem but mostly this error occured in cases where java version and javac version weren't the same but they were the same in my case..

 C:\Users\Acer>java -version
 java version "1.8.0_291"
 Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
 Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)

 C:\Users\Acer>javac -version
 javac 1.8.0_291

so how can i solve this problem?

Botje
  • 26,269
  • 3
  • 31
  • 41
  • Does this answer your question? [UnsupportedClassVersionError while 'flutter doctor --android-licenses' MacOS](https://stackoverflow.com/questions/75238629/unsupportedclassversionerror-while-flutter-doctor-android-licenses-macos) As the error suggests, you are trying to run code compiled for Java 11 in a Java 8 VM. – Botje Feb 06 '23 at 08:36

0 Answers0