当我尝试运行“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 R
untime (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)
Android sdkmanager tool was found, but failed to run (C:\\Users\\Gago\\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.
这是我的房扑医生:
Doctor summary (to see all details, run flutter doctor -v):
\[√\] Flutter (Channel stable, 3.7.7, on Microsoft Windows \[Version 10.0.19044.2604\], locale de-DE)
\[X\] Windows Version (Unable to confirm if installed Windows version is 10 or greater)
\[!\] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
\[√\] Chrome - develop for the web
\[√\] Android Studio (version 2022.1)
\[√\] IntelliJ IDEA Community Edition (version 2021.2)
\[√\] IntelliJ IDEA Ultimate Edition (version 2022.2)
\[√\] VS Code (version 1.75.1)
\[√\] Connected device (2 available)
\[√\] HTTP Host Availability
! Doctor found issues in 2 categories.
任何帮助都是感激的!
我已经试过卸载Android Sdk命令行工具并重新安装它,但没有帮助。我使用的是Android Studio,我的JDK是JDK 1. 8. 0_301。
2条答案
按热度按时间k5ifujac1#
有完全相同的JDK和flutter版本,我昨天遇到了这个问题(在MacBook中)。解决方案是访问Android Studio文件夹:
/应用程序/安卓Studio.app/Contents
并且有两个“jbr”和“jre”文件夹,因为“jre”只是“jbr”的副本
flutter doctor -v
命令报告 “未发现问题!" 此更改。wkftcu5l2#
检查您的gradle版本是否至少为7.6