gpt4 book ai didi

java - 无法运行 flutter doctor --android-licenses

转载 作者:行者123 更新时间:2023-12-05 00:13:29 25 4
gpt4 key购买 nike

我想在我的电脑上使用 flutter,我使用 Android Studio 和 Visual Studio Code。当我运行 flutter doctor 时,出现了这样的警告,

[√] Flutter (Channel stable, v1.17.3, on Microsoft Windows [Version 10.0.14393], locale id-ID)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit visit
https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.
[√] Android Studio (version 4.0)
[√] VS Code (version 1.45.1)
[!] Connected device
! No devices available

! Doctor found issues in 2 categories.

但是当我运行 flutter doctor --android-licenses 时出现这样的错误,错误与我运行命令 sdkmanager 相同/p>

C:\Users\Halim>flutter doctor --android-licenses
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more

在这种情况下我使用 jdk-13.0.1 并将其添加到路径环境中,目前我使用的是 Windows 10

对于环境变量我使用的设置如下

ANDROID_HOME = C:\Users\Halim\AppData\Local\Android\Sdk
ANDROID_SDK_ROOT = %ANDROID_HOME%\tools
JAVA_HOME = C:\Program Files\Java\jdk-13.0.1

这是我的 Windows 10 上的路径

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
C:\Users\Halim\AppData\Local\Programs\Microsoft VS Code\bin
C:\Users\Halim\AppData\Roaming\npm
%ANDROID_HOME%\platform-tools
%ANDROID_SDK_ROOT%\bin
%ANDROID_HOME%\tools
C:\Program Files\nodejs
%JAVA_HOME%\bin
C:\xampp\php
C:\flutter\bin

最佳答案

尝试使用 java 1.8 而不是 13.0.1,这可能会解决您的问题。

此错误与此错误类似:

Flutter A newer version of the Android SDK is required. To update, run: error?

关于java - 无法运行 flutter doctor --android-licenses,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62263234/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com