Cannot run flutter doctor --android-licenses

左心房为你撑大大i 提交于 2021-02-05 07:36:17

问题


I want to use flutter on my computer, I use Android Studio and Visual Studio Code. when I was running a flutter doctor, a warning like this appeared,

[√] 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.

but when there I run the flutter doctor --android-licenses there is an error like this, and the error is the same as I run the command sdkmanager

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

in this situation I use jdk-13.0.1 and have added it to the path environment, and currently I use Windows 10

for the environment variable I use the settings as follows

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

and this is the path on my 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

回答1:


Try to use java 1.8 instead of 13.0.1, that might solve your problem.

This error is similiar to this one:

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




回答2:


I faced this issue and solved it by these two steps:

  1. I've read in some articles that API level 29 Android 10.0 (Q) must be installed so I downloaded it
  1. I've uninstalled my Java JDK version 10 installation and installed JDK version 8 and set the JAVA_HOME and PATH environmental variables.

  2. I run flutter doctor --android-licenses .

  3. The exceptions was gone and I accepted all licences.

Done.



来源:https://stackoverflow.com/questions/62263234/cannot-run-flutter-doctor-android-licenses

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!