我尝试安装Flutter,但似乎无法通过flutter doctor中接受Android许可证的部分。当我尝试在命令提示符中运行“flutter doctor --android-licenses”时,我一直收到此错误。
C:\Users\anach>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:\Users\anach\AppData\Local\Android\sdk\cmdline-tools\latest\bin\sdkmanager.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.
我尝试了几乎所有的解决方案,包括在Android Studio的SDK管理器中手动下载Android SDK工具,但我仍然得到相同的错误。我读到有人在更新到Android Studio Electric Eel时遇到相同的问题。有人知道如何解决这个问题吗?
2条答案
按热度按时间j9per5c41#
您是否已检查是否安装了Android SDK命令行工具,您可以在Android Studio中的外观和行为〉系统设置〉Android SDK下进行检查。
Android Studio
ftf50wuq2#
将此许可证文件夹放在Android SDK根License文件夹中,然后重新启动IDE