Flutter.io Android License Status Unknown

232,753

Solution 1

If you updated the android SDK, the licenses may have changed. Depending on how you did the update you may or may not have been prompted to accept the changes, or maybe it just doesn't save the fact that you did accept them in a way flutter can understand.

To resolve, try running

flutter doctor --android-licenses

This should prompt you to accept licenses (it may ask you first, in case just type y and press enter - although it should tell you that).

If you still have problems after doing that, it might be worth either opening a new bug in the Flutter Github repository, or adding a comment on an existing issue like this one as it may be what you're seeing.

Solution 2

Just install the sdk command line tool(latest) the below in android studio. enter image description here

Then run: flutter doctor --android-licenses

After which you should get:

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

...and then you'll get a whole bunch of licenses to read whilst you sip your favourite beverage.

Solution 3

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

Solution 4

The right solution would be if you have android studio installed then

  1. open SDK manager
  2. under SDK tools uncheck hide obsolete packages at the bottom
  3. then you should see an option called Android SDK Tools (Obsolete)

enter image description here

  1. check it and apply and let the studio download the package
  2. once done run the command flutter doctor and it should now prompt you to run flutter doctor --android-licenses once you run the license command accept all licenses by hitting y and it should solve the problem

enter image description here

Solution 5

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

enter image description hereAndroid 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.

enter image description here 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, java_error 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 enter image description here

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

Share:
232,753

Related videos on Youtube

tdmiller
Author by

tdmiller

Updated on February 07, 2022

Comments

  • tdmiller
    tdmiller over 2 years
    >[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
        >>• Android SDK a ..\Android\sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-27, build-tools 27.0.3
        • Java binary at C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
        X Android license status unknown.
    

    I am getting an error with Android SDK when I run Flutter doctor, although I can still build/run it on my device. I was just curious about how to fix this issue. I believe I have the most updated version of the Android SDK downloaded, not sure what happened because I didn't have this issue last week.

    ##New Issues After following several possible fixes in the comments it has led to a new problem. I installed newer versions of android sdk P, 8, and 7 along with a new jdk10. Still not updated enough apparently.

    C:\Flutter\flutter>flutter doctor --android-licenses
    A newer version of the Android SDK is required. To update, run:
    C:\Users\tdmil\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
    

    C:\Flutter\flutter>C:\users\username\appdata\local\android\sdk\tools\bin\sdkmanager.bat --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: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
    
    • Gihanmu
      Gihanmu almost 4 years
      Might be useful for a future references. I was using Windows 10 and I had a JDK 11 version. As suggested by most of the people I downgraded my JDK to version 8. Then I executed flutter doctor. It still said license needs to be accepted. Then I ran flutter doctor --android-licenses and said yes for all license agreements. Finally the problem is gone :). Take away is downgrading to JDK 8 will fix the issue
    • Harshfi6
      Harshfi6 about 3 years
      This answer was helpful to install sdk play store licences from within android studio gui. stackoverflow.com/a/65899101/3834325
    • Lye Heng Foo
      Lye Heng Foo almost 3 years
      July 2021 update: With flutter 2.2.3, still seeing the same problem with latest Java 16. Installing Java 8 and setting JAVA_HOME to Java 8 installation directory, solved the Java exception error. OpenJDK 8 works too.
  • tdmiller
    tdmiller about 6 years
    I tried that solution the file seems to of changed slightly since then but I still made the modifications necessary but still no luck. I think I will just hope for an update later that fixes this because I can still run the application. Thank you anyways!
  • Cristiano
    Cristiano about 5 years
    another option, if you have both java 11 and 8 installed, is to export JAVA_HOME point to java8: export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
  • GabrielBB
    GabrielBB almost 5 years
    I changed JAVA_HOME to JDK 8 in Environment Variables on Windows and it worked
  • Huzaifa Asif
    Huzaifa Asif over 4 years
    It tells me A newer version of the Android SDK is required. To update, run: C:\Users\abc\AndroidSDK\tools\bin\sdkmanager --update. What should i do?
  • rmtmckenzie
    rmtmckenzie over 4 years
    @HuzaifaAsif have you tried running that command? It should fix the issue hopefully. If it fails then you might want to look up a different question or ask a new one about it.
  • Phani Rithvij
    Phani Rithvij over 4 years
    this doesn't work as java.se.ee is removed on the newer versions of java
  • Deepak Joshi
    Deepak Joshi over 4 years
    @HuzaifaAsif, I also faced this issue couple of times, As answered below by Tommie C, Try installing java 1.8 manually and setting $JAVA_HOME to it's bin folder, then run flutter doctor --android-licenses and accept all the licenses. Hope it helps.
  • mercury
    mercury about 4 years
    Stop! java 8.0.192-zulu is not available. Possible causes: * 8.0.192-zulu is an invalid version * java binaries are incompatible with Darwin * java has not been released yet
  • tdmiller
    tdmiller about 4 years
    Is this different than the top answer.
  • yair
    yair about 4 years
    this is exactly the current official docs for Mac as of 18 March 2020 - see flutter.dev/docs/get-started/install/… . It's a known issue.
  • Mahesh Jamdade
    Mahesh Jamdade about 4 years
    Thanks for the link @yair didn't knew that
  • Vahid
    Vahid about 4 years
    You can't do that in Java 11. You have to install Java 8. See this answer
  • yaniv maymon
    yaniv maymon about 4 years
    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
  • Mahmoud Harooney
    Mahmoud Harooney about 4 years
    @HuzaifaAsif how you re-installed the SDK... I am stucking in this error as I am using Android Studio version 3.6
  • marijnz0r
    marijnz0r about 4 years
    Thank you for your reply, this fixed my issue. I don't understand why someone downvoted it. Thank you again.
  • Lucas Saldanha
    Lucas Saldanha almost 4 years
    Just a heads up! This only worked for me using Java 8.
  • Say OL
    Say OL almost 4 years
    This really help me :)
  • Punita Ojha
    Punita Ojha over 3 years
    The only solution on internet that worked for me! Thanks buddy! :)
  • HIMANSHU MISHRA
    HIMANSHU MISHRA over 3 years
    Error: could not open `C:\Program Files\Android\Android Studio\jre\jre\lib\amd64\jvm.cfg' I am getting this error ?
  • Abhishek Thapliyal
    Abhishek Thapliyal over 3 years
    this was missed by me too :) Thanks alot
  • geg
    geg over 3 years
    I had to do this before running flutter doctor --android-licenses
  • Jim Newpower
    Jim Newpower over 3 years
    If on Linux, you can use: sudo update-alternatives --config java
  • Iqbal Safian
    Iqbal Safian over 3 years
    this is the most helpful answer, at least for my ubuntu machine.
  • Mauro Vanetti
    Mauro Vanetti about 3 years
    I fixed that by installing Android SDK Command-line Tools, which can be easily done in the SDK Manager.
  • Marty Spallone
    Marty Spallone about 3 years
    This worked for me on a new build. The other options of ENV variable and/or obsolete packages did not work. I am using Neo4j with JAVA 11 so I wanted to use this version. Not sure why developers make this so hard. Wasted a hour on this and have not even installed it yet.
  • SandaliTP
    SandaliTP about 3 years
    Works well! Thank you
  • BingLi224
    BingLi224 about 3 years
    With cmdline-tools without Android Studio, call sdkmanager "cmdline-tools;latest" in command line instead.
  • Harshfi6
    Harshfi6 about 3 years
    On MacOS, one should instead follow this answer stackoverflow.com/a/65899101/3834325
  • Mehul
    Mehul almost 3 years
    Been trying everything I find online for days, and this little help right here was the thing I was missing. Thank you. Idk why this isn't the accepted answer.
  • Player1
    Player1 almost 3 years
    This must be the accepted answer since all of us are tying to run the flutter doctor --android-licenses
  • Lye Heng Foo
    Lye Heng Foo almost 3 years
    July 2021 update: With flutter 2.2.3, still seeing the same problem with latest Java 16. Installing Java 8 and setting JAVA_HOME to Java 8 installation directory, solved the Java exception error. OpenJDK 8 works too.
  • Milan Bastola
    Milan Bastola almost 3 years
    Man you helped me. This should be a highlighted answer. :)
  • walid
    walid over 2 years
    worked for me, I think this is the best answer!!
  • DBencz
    DBencz over 2 years
    How come the official page doesn't mention this? Thank you sir!
  • RileyManda
    RileyManda over 2 years
    One solution that worked for me (macOS-BigSur),was adding the jdk to zsh and bash_profile:More details can be found on the following below link : mkyong.com/java/…