Flutter setup, android licenses unknown, Windows, VS Code

Issue

I’m having a (seemingly common) unknown license status issue. However, common fixes have not worked, such as flutter doctor --android-licenses, which can be seen in the console output below. I have gone to the link also – not helpful.

C:\Users\anonymous\OneDrive\Documents\Frameworks\flutter>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    X 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.

! Doctor found issues in 1 category.

C:\Users\anonymous\OneDrive\Documents\Frameworks\flutter>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:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 5 more

Any and all help will be greatly appreciated. Many thanks in advance 🙂

Solution

Installing the Android SDK Command-line Tools should fix the issue. Navigatie to settings,Appearance & Behavior -> System Settings -> Android SDK

Installing through the settings of Android Studio works for me

Then run:

flutter doctor --android-licenses

Which should give you something like this:

coolcoders@myhost ~ % flutter doctor --android-licenses
5 of 7 SDK package licenses not accepted. 100% Computing updates...             
Review licenses that have not been accepted (y/N)? y

Answered By – Marijn Berends

Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.