[!] Android toolchain - develop for Android devices (Android SDK 27.0.3) >>• Android SDK a ..\\Android\\sdk • Android NDK location not configured (optiona
After doing lots of analysis for my Ubuntu 20.04 I have found the solution
for me the error was /home/rk/Android/Sdk/tools/bin/sdkmanager
was missing write permission.
chmod +w home/rk/Android/Sdk/tools/bin/sdkmanager
Then run the below command.
flutter doctor --android-licenses
it automatically process the licences.
Refer--https://robbinespu.gitlab.io/blog/2020/03/03/flutter-issue-fixed-android-license-status-unknown-on-windows/
So here the solution, open your SDK manager then uncheck Hide Obsolete Packages
Now you’ll see Android SDK Tools (Obsolete) 26.1.1
appears. Tick that package and hit apply button
then ok button. it will download sdk.
then restart
Android studio
Nice, now if you run flutter doctor
, you should get positive result as below
PS D:\Workplace\flutter_projects> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.657], locale en-MY)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[√] VS Code (version 1.42.1)
[√] Connected device (1 available)
• No issues found!
PS D:\Workplace\flutter_projects> flutter doctor --android-licenses -v
All SDK package licenses accepted.======] 100% Computing updates...
Run flutter doctor --android-licenses
and enter Y when is asked
if needed we can download package manually here https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip (for Windows user). Hope this tutorial help people who looking for solution
I found this solution.I download JDK 8.Then I add downloading jdk file path name of JAVA_HOME into user variables in environment variable.
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:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 5 more
is occurring because the current SDK version is incompatible with Java 9.
So, to solve it, you can downgrade your java version to Java 8, or with a workaround, you can export the following option on your terminal:
Linux:
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
Windows:
set JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
And to make it stick, you can export the JAVA_OPTS in your profile file on Linux (.zshrc
, .bashrc
and etc.) or add as an environment permanently on Windows.
Then, you can type the flutter or sdkmanager command:
Flutter:
flutter doctor --android-licenses
sdkmanager:
sdkmanager --licenses
and type Y when needed to accept the licenses.
ps. This doesn't work for Java 11/11+, which doesn't have Java EE modules. For this option is a good idea, downgrade your Java version or wait for a Flutter update.
Ref: JDK 11: End of the road for Java EE modules
This was also my issue same as #16025
For an Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema This issue seems usually happens when you've installed Java 9 before. BTW it's not compatible with android-sdk try to remove Java 9 JDK if still exist.
In general JAXB APIs are considered to be Java EE APIs, and therefore are no longer contained on the default class path in Java SE 9. Java 9 introduces the concepts of modules, and by default the java.se aggregate module is available on the class path (or rather, module path). As the name implies, the java.se aggregate module does not include the Java EE APIs that have been traditionally bundled with Java 6/7/8. Fortunately, these Java EE APIs that were provided in JDK 6/7/8 are still in the JDK, but they just aren't on the class path by default. The extra Java EE APIs are provided in the following modules
Solution to workaround if you have Java9/10 installed
Replace
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME"'
With this one
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
For Android license status unknown issue, I've tried to solve by these steps:
Go to your Android SDK location C:\Users%user%\AppData\Local\Android\Sdk\tools\bin or ~/Library/Android/sdk/tools/bin
Run the command: ./sdkmanager --license
References
Failed to run sdkmanager --list (Android SDK) with Java 9
How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9
I am writing this because of the frustration in installing flutter... Most issues are caused by simple configuration issues. Follow these steps to resolve your issues.
STEP 1:ANDROID LICENSES --android-licenses, will resolve most cases
Since you are here you have reached "Android License Status Unknown" issue for Android tool chain,as many suggested tryflutter doctor --android-licenses
. If you are good with all the config. It should ask for an yes and press y and Voila. But if it shows a
Android sdkmanager tool not found (C\Users\__\local\Android\sdk\tools\bin\sdkmanager)
. Go to step two
STEP 2: SDK Manager installation from Android Studio
Open your Android Studio , File-> settings->System settings(left tab) ->Android SDK,
go to SDK Tool section
in that page, untick hide obsolete packages, select Android SDL tools(obsolete)
and press apply.
It will install the SDK and you confirm it by going and checking if this path exists(C\Users\__\local\Android\sdk\tools\bin\sdkmanager)
STEP 3: Repeat 1
Repeat step 1 after installation in a new command line check if its working , else go to STEP 4
STEP 4: sdkmanager --update
It will ask you update the sdk, just run the command given in terminal C\Users\__\local\Android\sdk\tools\bin\sdkmanager --update
. If it is running, then its cool. let it finish and repeat step 1, else if it is throwing some exceptions like java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
etc,
it means your java is not installed or not the correct version. Go to next step
STEP 5: JAVA 8.1 and JAVA_HOME path.
Install JAVA 8.1 and set JAVA_HOME path. Make sure it is version 8.1(register free account and download from oracle the 8.1 version, remember above 11+ wont work for flutter
NOTE: by yaniv maymon: if you already have Java installed on your computer and the sdkmanager --update still not working. go the environment variable and update the "JAVA_HOME" path to jdk folder. then exit the command prompt, open it again and run the update command –
STEP 6: Final Step
After installing and setting up path properly, run theC\Users\__\local\Android\sdk\tools\bin\sdkmanager --update
command in new terminal and it will work
STEP 7: Rerun flutter doctor,
You can see it saying to run the command flutter doctor --android-licenses
. so run flutter doctor --android-licenses
in terminal and press y when asked