If you are here it means that you are facing a frustrating exception regarding Android licenses in Flutter.
More specifically the exception occurs when you try to run the following command:
$ flutter doctor --android-licenses
and the output is something like this:
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
The easiest fix I found is to install the Android SDK Command-line Tools.
In Android Studio open
File > Settings > Appearance & Behavior > System Settings > Android SDK > SDK Tools
then tick the corresponding element, install and restart Android Studio and everything shoul work like a charm.
Happy coding!
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
Thanks, This fixed the erro
Happy to help ๐
thank you so much man!
You saved a lot of time of mine
You are welcome ๐
Thank You so much. Fixed my issue
Much Appreciated
๐
Thank you so much. It worked for me !
๐
this is the best solution available over internet !!!!
Thank you very much ๐
Yes thats work for me to
๐
Thank you so much๐โค
I tried many solutions but just this solution worked.
You are welcome ๐
Thanks!
๐
You are a real help
๐
Very Nice Edoardo ๐
Good work
Thank you Mohsin!
Sensacional! A soluรงรฃo perfeita!
๐
Thanks It worked for me…..
๐
Thank you so much!
๐
Thanks! it’s worked for me!
๐
Thanks a lot !
๐
Thank you! Solved the problem for me!
๐
Thanks It Worked.
๐
Thanks a lot, you really save my time
๐
Really simple and effective, many thanks!
You’re welcome ๐
Grazie mille!
Di niente! ๐
thank you very very much ๐ really you saved me at big problem
You are welcome ๐
That’s awesome!!! Thanks
๐
Superb! solved my problem
Thank you amadeo ๐
Thank You!!
๐
Hello there!
A mobile developer beginner here.
Please when you said “then tick the corresponding element” what were you referring to?
Am I to tick all elements that are “Not Installed”?
I’ll be glad to get a feedback from you.
Thank you.
Hello Emmanuel, as described here “The easiest fix I found is to install the Android SDK Command-line Tools.” you should select only the SDK command line tools ๐
Happy coding and enjoy Flutter!
It worked, nice! Thanks!
๐
Simple solution….saved me time and stress
๐