执行sdkmanager更新时如何解决此错误?

时间:2019-06-26 00:54:38

标签: flutter

有人知道我在执行该命令时遇到的问题吗?

C:\Users\<myusername>\AppData\Local\Android\sdk\tools\bin\sdkmanager
--update 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:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 5 more

扑打医生-v的结果:

[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.16299.847], locale en-CA)
    • Flutter version 1.5.4-hotfix.2 at C:\Development\flutter\flutter
    • Framework revision 7a4c33425d (8 weeks ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
    • Android SDK at C:\Users\CADAPER\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    X Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
      instructions.

[√] Android Studio (version 3.4)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 35.3.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] VS Code (version 1.35.1)
    • VS Code at C:\Users\CADAPER\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.1.0

[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

我还安装了最新的Android SDK和Java 12。

预先感谢您的帮助

1 个答案:

答案 0 :(得分:1)

如果您正在运行sdkmanager --update 运行flutter(如我在flutter doctor -v命令中所见),您不需要这样做。

请运行以下命令来避免出现“ X And​​roid许可证状态未知”的问题:

flutter doctor --android-licenses

并接受所有许可证。然后再次运行您的flutter程序。