Hello Guys How are you all? Hope You all are fine. I am trying to run flutter doctor and flutter doctor saying to accept license when I ran flutter doctor –android-licenses it gives a java error in a flutter. So today Here I come with all possible solutions for this error.
We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.
How flutter doctor –android-licenses gives a java error ?
I am trying to run flutter doctor and flutter doctor saying to accept license when I ran flutter doctor –android-licenses it gives a java error in a flutter.
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:521)
... 5 more
How to Solve flutter doctor –android-licenses gives a java error?
- How to Solve flutter doctor –android-licenses gives a java error?
To solve flutter doctor –android-licenses gives a java issue Just Install Android SDK Command-line tools from Android SDK Manager is solved my error. This solution is worked for me. Open Tools > SDK Manager From the left choose, Appearance & Behavior > System Settings > Android SDK Select SDK Tools from the top menu Check Android SDK Command-line tools and click 'apply'.
- flutter doctor –android-licenses gives a java
To solve flutter doctor –android-licenses gives a java issue Just Install Android SDK Command-line tools from Android SDK Manager is solved my error. This solution is worked for me. Open Tools > SDK Manager From the left choose, Appearance & Behavior > System Settings > Android SDK Select SDK Tools from the top menu Check Android SDK Command-line tools and click 'apply'.
Solution 1
Just Install Android SDK Command-line tools from Android SDK Manager is solved my error. This solution is worked for me.
- Open Tools > SDK Manager
- From the left choose, Appearance & Behavior > System Settings > Android SDK
- Select SDK Tools from the top menu
- Check Android SDK Command-line tools and click ‘apply’.

After Android Studio completed the installation, you can accept the licenses as expected:
flutter doctor --android-licenses
After choosing “yes” for all licenses, the android licenses are accepted. To confirm:
flutter doctor -v
Solution 2
I recommend clearing the android-studio-dir and android-sdk settings, and let flutter automatically detects their path instead: This works for me .
flutter config --android-studio-dir=""
flutter config --android-sdk=""
Solution 3
1. Install Android SDK Command-line Tools
Open SDK Manager
Top Menu -> Tools -> SDK Manager
Install command-line tools
- Unfold Appearance & Behavior
- Unfold System Settings
- Click Android SDK
- Click tab of SDK Tools
- Check Android SDK Command-line Tools (latest).
- Click OK and Android Studio can install it.
Summery
So, It’s All About This Error. I hope this tutorial helps you solve your error. Please Comment Below if You stucks anywhere with my code.
Also Check Out Below Tutorials
- How to make a blur Background Image effect in Flutter using BackdropFilter.
- How to add Border Radius to Container in Flutter ?
- Also Read How To Use Date Picker in Flutter
- How to Create TabBar in Flutter Complete Guide To Make TabBar
- How to Create Popup in Flutter Popup Menu Example
I had to install JDK 8 (the reference implementation) and set it as my JAVA_HOME when running the flutter doctor for it to work, even after installing the Android SDK tools.
i ma facicng this issue
C:\Users\USER>flutter doctor –android-licenses
Error: Could not find or load main class ”
Caused by: java.lang.ClassNotFoundException: ”
how do i resolve this error;
Which Java version you have installed in your PC ? I Recommend you Java 8 must be installed And make sure you have set JAVA_HOME path and then Install command-line tools
Open SDK Manager
Top Menu -> Tools -> SDK Manager
Install command-line tools
Unfold Appearance & Behavior
Unfold System Settings
Click Android SDK
Click tab of SDK Tools
Check Android SDK Command-line Tools (latest).
Click OK and Android Studio can install it.