0

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?

Harry
  • 154
  • 4
  • 15

1 Answers1

0

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

  • I have followed this above procedure but when I type `flutter doctor --android-licences` I am getting the error which I have stated in question. – Harry Apr 28 '21 at 22:10
  • Okay @Harry try this might help to get out of this exception. https://stackoverflow.com/questions/64708446/flutter-doctor-android-licenses-exception-in-thread-main-java-lang-noclass – Muhammed Ahsan Apr 28 '21 at 22:16
  • Thank you. The same procedure is followed. You can answer the question and I will accept your answer. – Harry Apr 28 '21 at 22:20
  • @harry updated my orignal post now you can accept this answer :) have a great day . – Muhammed Ahsan Apr 28 '21 at 22:35
  • If the command line did not show (y/n) please install CMake and install other versions of Command-line tools – saber tabatabaee yazdi Oct 02 '21 at 05:35