如何修复颤振中未知的 Android 许可证状态?

2022-01-08 00:00:00 flutter sdk android android-studio java

当我运行颤振医生检查一切是否正常时,我发现了这个问题"Android 许可证状态未知.运行 flutter doctor --android-licenses 以接受 SDK 许可.请参阅 https://flutter.dev/docs/get-started/install/windows#android-setup 以获取更多详细信息.",当我之前运行 flutter doctor --android-licenses 时,会在线程main"中显示 Exceptionjava.lang.NoClassDefFoundError: javax/xml/bind/JAXBException at com.android.repository.api.RemoteListSourceProvider.create(RemoteListSourceProvider.java:51) at com.android.sdklib.repository.AndroidSdkHandler$RepoConfig.<init>(AndroidSdkHandler.java:626) 在 com.android.sdklib.repository.AndroidSdkHandler.getRepoConfig(AndroidSdkHandler.java:572) 在 com.android.sdklib.repository.AndroidSdkHandler.getSdkManager(AndroidSdkHandler.java:295) 在 com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.setSdkHandler(SdkManagerCliSettings.java:101) 在 com.android.sdklib.tool.sdkmanager.SdkManagerCli.<init>(SdkManagerCli.java:95) 在 com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:74) at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48) 原因:java.lang.ClassNotFoundException: javax.xml.bind.JAXBException at java.基础/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) 在 java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 8 更多

When I run flutter doctor to check if everything is good I find this problem " 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.", and when I run flutter doctor --android-licenses previously is show up Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException at com.android.repository.api.RemoteListSourceProvider.create(RemoteListSourceProvider.java:51) at com.android.sdklib.repository.AndroidSdkHandler$RepoConfig.<init>(AndroidSdkHandler.java:626) at com.android.sdklib.repository.AndroidSdkHandler.getRepoConfig(AndroidSdkHandler.java:572) at com.android.sdklib.repository.AndroidSdkHandler.getSdkManager(AndroidSdkHandler.java:295) at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.setSdkHandler(SdkManagerCliSettings.java:101) at com.android.sdklib.tool.sdkmanager.SdkManagerCli.<init>(SdkManagerCli.java:95) at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:74) at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 8 more

但是在我使用这个命令之后 JAVA_OPTS=-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee ,这就是我得到的错误:无法找到或加载主类 '-XX:+IgnoreUnrecognizedVMOptions 原因:java.lang.ClassNotFoundException: '-XX:+IgnoreUnrecognizedVMOptions

but after I use this command JAVA_OPTS=-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee ,this what I get Error: Could not find or load main class '-XX:+IgnoreUnrecognizedVMOptions Caused by: java.lang.ClassNotFoundException: '-XX:+IgnoreUnrecognizedVMOptions

我怎样才能解决所有这些问题?

How I can fix all of these problems?

注意:Android SDK Tools (Obsolete) 26.1.1 安装在我的 android studio 上

NOTE: Android SDK Tools (Obsolete) 26.1.1 is installed on my android studio

推荐答案

尝试将您的 jdk 版本更新到最新并再次设置 jdk 路径.另外,设置 JAVA_HOME 并确保构建 gradle 在 android studio 中成功完成.将 sdk 工具更新到最新版本,然后重试.

try updating your jdk version to the latest and setting jdk path again. also, set JAVA_HOME and make sure build gradle is completed successfuly in android studio. update sdk tools to the latest version and try again.

相关文章