Flutter doctor --android-licenses problem

Viewed 1214

hope you guys doing well. I was trying to run this command in flutter console:

   flutter doctor --android-licenses

here is the error:

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

I searched a lot but I did not find out the solution. Can someone please help me?

2 Answers

You need to install Android SDK Command-line tools, note you need to ensure you are having JavaJDK installed as well.

enter image description here

I actually find a half solution. I opened sdkmanager and then changed this line:

set DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0.."

to this:

set DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0.." -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee

and I also changed Execute sdkmanager to this:

"%JAVA_EXE%" %DEFAULT_JVM_OPTS% -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee %JAVA_OPTS% %SDKMANAGER_OPTS% -classpath "%CLASSPATH%" com.android.sdklib.tool.sdkmanager.SdkManagerCli %CMD_LINE_ARGS%

but still it is not working. here is the error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.se.ee not found
Related