Flutter doctor –android-licenses not working

Issue

I have installed flutter 2 on a windows laptop. When I run flutter doctor it works fine but I understand that we have to accept licenses by flutter doctor --android-licenses. When I run this command I found below error

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:636)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
        ... 5 more

I don’t know about this error and how to solve this?

Solution

Try these steps:

  1. Open your terminal
  2. type flutter doctor --android-licenses
  3. press y to accept every license.

original link to the post is here

UPDATED ANSWER to this POST

Installing Android SDK Command-line tools from Android SDK Manager did the job.

  1. Open Android Studio
  2. Tools > SDK Manager
  3. From the left choose, Appearance & Behavior > System Settings > Android SDK Select SDK
  4. Tools from the top menu Check Android SDK Command-line tools and
  5. click ‘apply’.

orignal link to the post here

Answered By – Muhammed Ahsan

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.