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/sdklib/tool/sdkmanager/SdkManagerCli has been compiled by a more recent version of the Java Runtime (class file version 61.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:757) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) 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:419) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:352) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:621) Android sdkmanager tool was found, but failed to run (/Users/zhangwu/Library/Android/sdk/cmdline-tools/11.0/bin/sdkmanager): "exited code 1". Try re-installing or updating your Android SDK, visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.
在mac上的解决办法:
运行
/usr/libexec/java_home -V
配置临时的JAVA_HOME
export JAVA_HOME="/Users/zhangwu/Library/Java/JavaVirtualMachines/corretto-17.0.7/Contents/Home"
再次运行就可以了。
标签:java,URLClassLoader,ClassLoader,version,file,class From: https://www.cnblogs.com/hbolin/p/17593521.html