I'm having a (seemingly common) unknown license status issue. However, common fixes have not worked, such as flutter doctor --android-licenses, which can be seen in the console output below. I have gone to the link also - not helpful.
C:\Users\anonymous\OneDrive\Documents\Frameworks\flutter>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
! Doctor found issues in 1 category.
C:\Users\anonymous\OneDrive\Documents\Frameworks\flutter>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)
... 5 more
Any and all help will be greatly appreciated. Many thanks in advance :)
Installing the Android SDK Command-line Tools should fix the issue. Navigatie to settings,Appearance & Behavior -> System Settings -> Android SDK
Then run:
flutter doctor --android-licenses
Which should give you something like this:
coolcoders#myhost ~ % flutter doctor --android-licenses
5 of 7 SDK package licenses not accepted. 100% Computing updates...
Review licenses that have not been accepted (y/N)? y
Related
I am trying to set up Flutter with Android Studio (Arctic Fox 2020.3.1 Beta 3) on my Macbook 13" M1 and I can't with flutter doctor I get this information:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.3 20E232 darwin-arm, locale de-DE)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[!] Android Studio
✗ Unable to find bundled Java version.
[✓] VS Code (version 1.56.2)
[✓] Connected device (3 available)
When I try to accept the android licences I get this 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: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
check this issue: https://github.com/flutter/flutter/issues/81909
Specifically, this part:
Go to sdk manager, and download Android SDK command line tools and try again
I have
Install Andriod Studio and Java. This is the current issue.
I can't do anything. A similar error was posted and confused me futher
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.19041.685], locale th-TH)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[!] Android Studio (not installed)
[√] Connected device (2 available)
! Doctor found issues in 2 categories.
C:\Users\asus>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
Try Downloading the Android SDK Command-line Tools (latest) on Android Studio, under settings > Appearance & Behavior > System Settings > Android SDK > SDK Tools and re-running flutter doctor --android-licenses
C:\Users\USER>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.19042.928], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Android Studio
[√] VS Code (version 1.56.1)
[√] Connected device (2 available)
! Doctor found issues in 1 category.
C:\Users\USER>flutter doctor --android-licenses
Error: Could not find or load main class J\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\\..
Caused by: java.lang.ClassNotFoundException: J\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\\//
EDIT 1:
I tried reinstalling sdk (after deleting files completely from appdata/android/sdk). it kinda worked but now new error is showing.:
C:\Users\USER>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)
... 5 more
After a lot of searching and a lot of diff types of error ranging from environmental variable errors and java errors, i just uninstalled android studio, java and flutter files
deleted appdatas etc. and reinstalled it again now flutter doctors works fine.
i know this is not a good solution but someone could try this if all else fails.
thks
The crux of this issue seem to be with spaces in the Android SDK path, e.g. if your user name on windows is "John Smith", it will fail to detect the android SDK. The solution is to move 'C:\Users\John Smith\AppData\Local\Android\Sdk' to a path with no spaces, e.g. 'C:\Android\Sdk'. Then run the following
flutter config --android-sdk "C:\Android\Sdk"
PS: for a related issue where it says "[!] Android Studio (not installed)", run the following to manually point it to the default Android Studio install location
flutter config --android-studio-dir "C:\Program Files\Android\Android Studio"
When I try to accept android licenses using command flutter doctor --android-licenses a java error is thrown.
Here is java 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:522)
... 5 more
Here is my output for flutter doctor -v:
How can I solve above java error?
Note: I want to solve this problem without using Android Studio.
The problem is happened because when running flutter doctor --android-licenses, it implicitly running the sdk tools which is only works with JDK 8 (afaik, correct me if I'm wrong).
So, you need to install JDK 8 and set your JAVA_HOME to your JDK 8 installation path.
I have seen similar issues but they somehow could not resolve my issue.
I am currently using Windows and Versions Java 8, Java SDK 13.0.1, Android Studio v3.5.2.
1) I First typed flutter doctor and got the following error : Android license status unknown.
2) I then entered flutter doctor --android-licenses and got the following command
A newer version of the Android SDK is required. To update, run:
C:\Users\user\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
3) Running this line I ended up here :
D:\flutter\flutter>C:\Users\user\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
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
Please let me know the simple steps i could follow as I am confused about this a lot!
To resolve, try running flutter doctor --android-licenses. This should prompt you to accept licenses just type y and enter to accept the licence if error persists check out this issue