我正在尝试接受 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
我使用的是 MacOS Ventura。我今天安装了Android Studio。这就是我解决问题的方法:
- 已下载JDK19 https://www.oracle.com/java/technologies/downloads/#jdk19-mac
- 按照此处提到的步骤进行操作link https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/#what-is-usrlibexecjava-home
- 由于我正在运行 Android Studio Electric Eel,因此打开终端并运行此命令
cd /Applications/Android\ Studio.app/Contents/jbr
- 然后运行这个命令
ln -s ../jbr jdk
- 最后,
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
- 转到 Finder -> 应用程序 -> Android Studio。右键单击 Android Studio 并选择“显示包内容”
- 在文件夹“Contents”中创建了新文件夹“jre”
- 将“jbr”文件夹中的内容复制到“jre”文件夹
- Ran
flutter doctor
again
- Ran
flutter doctor --android-licenses
.
之后我能够成功同意许可。
还提到了所有步骤here https://stackoverflow.com/questions/51281702/unable-to-find-bundled-java-version-on-flutter/68575967#68575967 and here https://levelup.gitconnected.com/how-to-install-flutter-on-macos-6e65dc592449
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)