Solve Exception Error on ʺflutter doctor --android-licensesʺ Command

Are you have to hit Are you getting an exception error while you execute the command "flutter doctor --android-licenses". This command is necessary to accept the Android SDK license. See the example below to solve this issue on Flutter.

hari@hpc:~/flutter_sdk$ 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)

1. Open Android Studio, and go to SDK Manager.

2. Go to SDK Tools, and Check "Android SDK Command Line Tools", and Hit Apply.

Now, SDK Manager will install "Android SDK Command-line Tools", after installing, hit the command below to accept the Android SDK license. 

flutter doctor --android-licenses

After accepting all the SKD licenses, hit the flutter doctor command again.

In this way, you can solve the exception error on command "flutter doctor --android-licenses".

No any Comments on this Article


Please Wait...