Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✗ Android license status unknown. #16025

Closed
NatoBoram opened this issue Mar 28, 2018 · 130 comments · Fixed by #16035
Closed

✗ Android license status unknown. #16025

NatoBoram opened this issue Mar 28, 2018 · 130 comments · Fixed by #16035
Labels
platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@NatoBoram
Copy link

NatoBoram commented Mar 28, 2018

Steps to Reproduce

Please tell us what you were doing and what went wrong. If you are running flutter tools from the command line, please try adding the -v or --verbose option to gather more information.

  1. Run flutter upgrade.

What went wrong

✗ Android license status unknown.

What should happen
There shouldn't be a problem. The build from last week did not output a problem, and this week's build shouldn't output a problem.

What I tried to fix the problem

  1. Upgraded Android Studio
  2. Added a few random SDK in the SDK Manager
  3. sudo chown -R $USER:$USER /opt/*
  4. flutter doctor --android-licenses

If the problem is with your application's rendering, please attach a screenshot and any relevant source code.
If you are getting an exception in the logs, and your code is implicated in the first few frames, then please include the source code for the functions involved.

Logs

Run your application with flutter run and attach all the log output.

Launching lib/main.dart on Nexus 5 in debug mode...
Initializing gradle...                                       0.8s
Resolving dependencies...                                   11.8s
Running 'gradlew assembleDebug'...                           4.7s
Built build/app/outputs/apk/debug/app-debug.apk (26.9MB).

The app then opens in the device and immediately crashes.

Run flutter analyze and attach any output of that command also.

Analyzing /home/users/n.gendron/GitLab/n.gendron/techno_store...
  lint • Close instances of `dart.core.Sink` at lib/server.dart:10:20 • close_sinks
  hint • 'BASE64' is deprecated and shouldn't be used at lib/edit.dart:85:9 • deprecated_member_use
  hint • 'JSON' is deprecated and shouldn't be used at lib/globals.dart:70:12 • deprecated_member_use
  hint • 'JSON' is deprecated and shouldn't be used at lib/globals.dart:80:19 • deprecated_member_use
  hint • 'BASE64' is deprecated and shouldn't be used at lib/item.dart:83:11 • deprecated_member_use
  hint • 'JSON' is deprecated and shouldn't be used at lib/server.dart:50:36 • deprecated_member_use
  hint • 'JSON' is deprecated and shouldn't be used at lib/server.dart:129:17 • deprecated_member_use
7 issues found.
(Ran in 8.2s)

Oh, what happened the last two days?

Flutter Doctor

Paste the output of running flutter doctor -v here.

[✓] Flutter (Channel beta, v0.2.3, on Linux, locale en_US.UTF-8)
    • Flutter version 0.2.3 at /home/users/n.gendron/GitHub/flutter
    • Framework revision 5a58b36e36 (2 weeks ago), 2018-03-13 13:20:13 -0700
    • Engine revision e61bb9ac3a
    • Dart version 2.0.0-dev.35.flutter-290c576264

[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /opt/android-sdk/
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • ANDROID_HOME = /opt/android-sdk/
    • Java binary at: /opt/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    ✗ Android license status unknown.

[✓] Android Studio (version 3.1)
    • Android Studio at /opt/android-studio
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] Connected devices (1 available)
    • Nexus 5 • 05473ea90a673764 • android-arm • Android 7.1.2 (API 25)

! Doctor found issues in 1 category.
flutter doctor --android-licenses
Warning: java.net.ConnectException: Connection timed out (Connection timed out) 
Warning: Failed to download any source lists! Fetch remote repository...        
Warning: File /home/users/n.gendron/.android/repositories.cfg could not be loaded.
All SDK package licenses accepted.======] 100% Computing updates... 

For more information about diagnosing and reporting Flutter bugs, please see https://flutter.io/bug-reports/.

Edit : Oh hey, I forgot to add some info about my system. It should probably be noted somewhere in the template to add it.

OS: Ubuntu 16.04.4 LTS x86_64 
Kernel: 4.13.0-38-generic 
Uptime: 17 hours, 31 mins 
Packages: 3069 
Shell: bash 4.3.48 
Resolution: 1024x768, 1920x1080 
DE: GNOME 3.18.5 
WM: GNOME Shell 
WM Theme: Adwaita 
Theme: Greybird [GTK2/3] 
Icons: Elementary-xfce-darker [GTK2/3] 
CPU: Intel i5 660 (4) @ 2.035GHz 
GPU: NVIDIA GeForce 8400 GS Rev. 2 
Memory: 4576MiB / 7840MiB 
java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Edit : Most people stumbling here had a different problem from the one I had, and its solution is here.

Modify sdkmanager to use Java 8 by setting JAVA_HOME inside sdkmanager to a Java 8 installation. It's, by default, at ~/Android/Sdk/tools/bin/sdkmanager.

# Add default JVM options here. You can also use JAVA_OPTS and SDKMANAGER_OPTS to pass JVM options $
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions'
@rem Add default JVM options here. You can also use JAVA_OPTS and SDKMANAGER_OPTS to pass JVM options to this script.
set JAVA_HOME="C:\ProgramData\scoop\apps\android-studio\current\jre"
set DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0\.."

This way, you can keep using a sane and maintained version of Java on your system while simultaneously using sdkmanager.

# Java
export JAVA_HOME=/usr/lib/jvm/default-java

And now I've got some pipelines to repair.

@lukef
Copy link
Contributor

lukef commented Mar 28, 2018

To add some info only - Android's sdkmanager tool (on windows at least) crashes when executing the check. See the discussion here: https://stackoverflow.com/questions/47150410/failed-to-run-sdkmanager-list-android-sdk-with-java-9.

@irisida
Copy link

irisida commented Mar 28, 2018

Similar issues here, but minus the crash. Fairly trivial app still runs.

[✓] Flutter (Channel beta, v0.2.3, on Mac OS X 10.12.6 16G1212, locale en-GB)
    • Flutter version 0.2.3 at /Users/ed/devsetups/flutter
    • Framework revision 5a58b36e36 (2 weeks ago), 2018-03-13 13:20:13 -0700
    • Engine revision e61bb9ac3a
    • Dart version 2.0.0-dev.35.flutter-290c576264

[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/ed/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • ANDROID_HOME = /Users/ed/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    ✗ Android license status unknown.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.2, Build version 9C40b
    • ios-deploy 1.9.2
    • CocoaPods version 1.4.0

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] VS Code (version 1.21.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Dart Code extension version 2.10.0

[✓] Connected devices (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 5.1.1 (API 22) (emulator)

! Doctor found issues in 1 category. 

@Herohtar
Copy link

I'm not getting any crashes and my app still runs, but flutter doctor complains about license status for me as well after upgrading.

[√] Flutter (Channel beta, v0.2.3, on Microsoft Windows [Version 10.0.16299.309], locale en-US)
    • Flutter version 0.2.3 at C:\Users\Caleb\Google Drive\Android\flutter
    • Framework revision 5a58b36e36 (2 weeks ago), 2018-03-13 13:20:13 -0700
    • Engine revision e61bb9ac3a
    • Dart version 2.0.0-dev.35.flutter-290c576264

[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Users\Caleb\AppData\Local\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.

[√] Android Studio (version 3.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 64-bit edition (version 1.21.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Dart Code extension version 2.11.1

[!] Connected devices
    ! No devices available

! Doctor found issues in 2 categories.

@Zedonboy
Copy link

Me too, i have tried installing Android sdk 27.0.3

@Zedonboy
Copy link

Hi everyone,
type $flutter doctor --android-licenses
It might say some licenses are not accepted(something like that)
you will be asked 'Do you want to review the licenses'?
typey<press enter>

accept all the licenses review.

now check flutter again with $flutter doctor

@Herohtar
Copy link

Trying @Zedonboy's suggestion gave me some more problems...

flutter doctor --android-licenses
A newer version of the Android SDK is required. To update, run:
C:\Users\Caleb\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
C:\Users\Caleb\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: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

@lukef
Copy link
Contributor

lukef commented Mar 29, 2018

@Herohtar - See my reply above. Did that workaround not work?
I submitted a patch for flutter to fix this until the Android tooling issue is resolved.

@ac130kz
Copy link

ac130kz commented Mar 29, 2018

Android Studio stuff doesn't like Java 9 for whatever reason, simply install and export Java 8 OpenJDK and then rerun, worked for me.

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/

@NatoBoram
Copy link
Author

flutter doctor --android-licenses
Warning: java.net.ConnectException: Connection timed out (Connection timed out) 
Warning: Failed to download any source lists! Fetch remote repository...        
Warning: File /home/users/n.gendron/.android/repositories.cfg could not be loaded.
All SDK package licenses accepted.======] 100% Computing updates... 
flutter doctor -v
[✓] Flutter (Channel beta, v0.2.3, on Linux, locale en_CA.UTF-8)
    • Flutter version 0.2.3 at /home/users/n.gendron/GitHub/flutter
    • Framework revision 5a58b36e36 (2 weeks ago), 2018-03-13 13:20:13 -0700
    • Engine revision e61bb9ac3a
    • Dart version 2.0.0-dev.35.flutter-290c576264

[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /opt/android-sdk/
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • ANDROID_HOME = /opt/android-sdk/
    • Java binary at: /opt/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    ✗ Android license status unknown.

[✓] Android Studio (version 3.1)
    • Android Studio at /opt/android-studio
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] Connected devices (1 available)
    • Nexus 5 • 05473ea90a673764 • android-arm • Android 7.1.2 (API 25)

! Doctor found issues in 1 category.

@wongni
Copy link

wongni commented Mar 29, 2018

I set the JAVA_HOME with the JRE in the Android studio and then flutter doctor --android-licenses just worked. For me, the JRE path was C:\Program Files\Android\Android Studio\jre

@Herohtar
Copy link

@lukef I tried your workaround, but unfortunately it did not do anything for me. Do you need to do something more than just adding the one line in android_sdk.dart?

I was able to make it work using @wongni's method of just pointing JAVA_HOME at the Android Studio JRE, but that doesn't seem ideal.

@lukef
Copy link
Contributor

lukef commented Mar 30, 2018

@Herohtar - if you modify the tools you need to also clear the build tools snapshot to rebuild them otherwise that one line change wont do anything. If you read the link I posted the workaround is to use the SDKMANAGER_OPTS environment variable. That's all that my change is actually doing.

On a mac it would be:

export SDKMANAGER_OPTS="--add-modules java.se.ee"

This should solve the Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema error that you are seeing when sdkmanager is run.

Alternatively, that link offers other suggestions. If you find out that the solution is different, report back.

The link again in case you missed it: https://stackoverflow.com/questions/47150410/failed-to-run-sdkmanager-list-android-sdk-with-java-9.

@irisida
Copy link

irisida commented Mar 30, 2018

@lukef The above env var worked for me. Many thanks for this.

@Herohtar
Copy link

@lukef Ah, thanks. It works with your change after deleting the flutter tools snapshot.

@MoltenFiber
Copy link

MoltenFiber commented Apr 2, 2018

i had the same problem. tried all of the above but didn't fix it. what i did is:
Please have backups before continuing, expecially sdkmanager part

went to Environment variables and added ANDROID_HOME with a variable value of: C:\Users\%username%\AppData\Local\Android\Sdk
then my JAVA_HOME with this variable value:
C:\Program Files\Android\Android Studio\jre
then my Path with this variable value:
C:\Users\%username%\flutter\bin

Then I went to C:\Users\%username%\AppData\Local\Android\Sdk\tools\bin
and opened sdkmanager.bat with a note editor, this was my DEFAULT_JVM_OPTS:

@rem Add default JVM options here. You can also use JAVA_OPTS and SDKMANAGER_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0\.."

Then i ran:
flutter doctor
got output of:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.2.3, on Microsoft Windows [Version 10.0.16299.309], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.1)
[√] Connected devices (1 available)

! Doctor found issues in 1 category.

Then i ran
flutter doctor --android-licenses
and accepted all Terms & Conditions with (y)

This solved my problems. hope it helps you.

@tvolkert
Copy link
Contributor

tvolkert commented Apr 4, 2018

Fix was reverted because it introduced other problems. Re-opening.

@tvolkert tvolkert reopened this Apr 4, 2018
@tvolkert
Copy link
Contributor

tvolkert commented Apr 4, 2018

FYI, the other problems that it introduced are detailed in #16228

@AmineMersoul
Copy link

i have this same issue, i tried
flutter doctor --android-licenses
it show me this message

A newer version of the Android SDK is required. To update, run:
F:\Sdk\tools\bin\sdkmanager --update

and sdkmanager --update give me this warning

Warning: File C:\Users\Amine\.android\repositories.cfg could not be loaded.
done

i checked that path there no file named repositories.cfg
and then i updated sdk manager from android studio
and still have the same issue

flutter doctor -v

[√] Flutter (Channel beta, v0.2.3, on Microsoft Windows [Version 10.0.16299.309], locale en-US)
    • Flutter version 0.2.3 at F:\flutter
    • Framework revision 5a58b36e36 (3 weeks ago), 2018-03-13 13:20:13 -0700
    • Engine revision e61bb9ac3a
    • Dart version 2.0.0-dev.35.flutter-290c576264

[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at F:\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-P, build-tools 27.0.3
    • ANDROID_HOME = F:\Sdk
    • 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.

[√] Android Studio (version 3.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 64-bit edition (version 1.20.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Dart Code extension version 2.9.2

[!] Connected devices
    ! No devices available

! Doctor found issues in 2 categories.

@jukbot
Copy link

jukbot commented Apr 6, 2018

@AmineMersoul

Got the same issue, I've tried to create an empty repositories.cfg file but Android license status unknown. still remain.

Ref: https://stackoverflow.com/questions/43433542/stuck-at-android-repositories-cfg-could-not-be-loaded

@HerbertKoelman
Copy link

Here is how I fixed this issue #16280 on my Mac :-)

@tvolkert
Copy link
Contributor

tvolkert commented Apr 6, 2018

@lukef do you know if there's a way to re-introduce #16035 in such a way as to avoid #16228?

@fzdp
Copy link

fzdp commented Apr 7, 2018

I encountered this problem on MacOS just now, it turned out to be a lack of JDK. Here is my solution:

  1. http://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html download and install jdk
  2. set JAVA_HOME environment, e.g. export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home
  3. run flutter doctor -v again, if you see something like:

Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

then run command flutter doctor --android-licenses and accept licenses.
Hope this will be helpful.

@lukef
Copy link
Contributor

lukef commented Apr 8, 2018

@tvolkert - sorry for the late reply.

I have a valid JAVA_HOME and am using Java 9. I can upgrade to Java 10 and try again.

I thought the flag would be ignored by Java 8 and below (I think this is a java 9+ flag). Sorry about that.

With that said, I feel like there may be an inherent danger in solving this problem via code as, ultimately, the fix belongs in the Android tooling and not in Flutter. Maybe this is a documentation issue instead. The overall workarounds available now are:

  • If using Java 9+, document that the environment variable to allow execution of the module is required: export SDKMANAGER_OPTS="--add-modules java.se.ee"
  • Force people to use Java 8 or below

It's annoying to ask people to add yet another environment variable, so I could see that as being unacceptable, but it will fix the issue.

Otherwise, we could attempt to detect the installed Java version and apply the flag conditionally. This is probably super hard across all platforms to do it consistently.

@AmineMersoul
Copy link

i have both Java 8 and 9 installed in my computer
but in windows environment variables path i set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_151
i still have the problem

@tvolkert
Copy link
Contributor

tvolkert commented Apr 8, 2018

@lukef we already have code that tries to validate the Java version, so that ship's already sailed:

bool _checkJavaVersion(String javaBinary, List<ValidationMessage> messages) {

You could refactor that such that we had a String get javaVersion getter that we could consult in the sdkManagerEnv getter...

@phanirithvij
Copy link

I set the JAVA_HOME with the JRE in the Android studio and then flutter doctor --android-licenses just worked. For me, the JRE path was C:\Program Files\Android\Android Studio\jre

This worked for me

@dev-sankeerth
Copy link

Trying @Zedonboy's suggestion gave me some more problems...

flutter doctor --android-licenses
A newer version of the Android SDK is required. To update, run:
C:\Users\Caleb\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
C:\Users\Caleb\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: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

I had the same issue, and it was solved when I downgraded java from java 13 to java 8.

@hylinux1024
Copy link

in terminal set java 1.8 home path

export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"
then

try

/Users/mac/Library/Android/sdk/tools/bin/sdkmanager --update

DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Accept? (y/N): y
...

@MisdakM
Copy link

MisdakM commented Dec 29, 2019

In order to fix this, I uninstalled JDK 13 that I had installed earlier, then :

  1. Install JDK 8
  2. flutter doctor --android-licenses

Hope this helps... ^_^

@bsikriwal
Copy link

bsikriwal commented Jan 1, 2020

Important update

OpenJDK 10 was superseeded by OpenJDK 11, which doesn't implement java.se.ee at all. This means that the hack of adding --add-modules java.se.ee doesn't do anything anymore. It also means that OpenJDK 10 will be automatically removed from your system and replaced with OpenJDK 11 the next time you update, if your updates are configured properly.

To fix that, modify sdkmanager to use Java 8 by setting JAVA_HOME inside sdkmanager to a Java 8 installation. It's still, by default, at ~/Android/Sdk/tools/bin/sdkmanager.

# Add default JVM options here. You can also use JAVA_OPTS and SDKMANAGER_OPTS to pass JVM options $
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions'
@rem Add default JVM options here. You can also use JAVA_OPTS and SDKMANAGER_OPTS to pass JVM options to this script.
set JAVA_HOME="C:\ProgramData\scoop\apps\android-studio\current\jre"
set DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0\.."

This way, you can keep using a sane and maintained version of Java on your system while simultaneously using sdkmanager.

# Java
export JAVA_HOME=/usr/lib/jvm/default-java

And now I've got some pipelines to repair.

To fix that, modify sdkmanager to use Java 8 by setting JAVA_HOME inside sdkmanager to a Java 8 installation. It's still, by default, at ~/Android/Sdk/tools/bin/sdkmanager.

I am just starting up with all these things.
Can you please tell me how to modify sdkmanager to use Java 8 by setting JAVA_HOME inside sdkmanager to a Java 8 installation. Like actually how to access JAVA_HOME inside sdkmanager since its a exec file.

@JenuelDev
Copy link

update android sdk in android studio... It worked for me. because if you updated your flutter, it needs also the updated version of the sdk. for the environment to work properly

@carmady
Copy link

carmady commented Jan 28, 2020

RESOLVED ,
before I use JDK 13 (newver) and found this issue sdk unknow , then I uninstall jdk 13 then install jdk 8 , update your variable JAVA_HOME , then restart your computer , then run flutter doctor ,

Microsoft Windows [Version 10.0.17763.973]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\karmadi>flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Version 10.0.17763.973], locale en-US)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.5)
[√] VS Code (version 1.41.1)
[!] Connected device
! No devices available

! Doctor found issues in 2 categories.

C:\Users\karmadi>flutter doctor --android-licenses
Warning: File C:\Users\karmadi.android\repositories.cfg could not be loaded.
6 of 7 SDK package licenses not accepted. 100% Computing updates...
Review licenses that have not been accepted (y/N)? y
*** and then will show more angreement you have to tap y**
until this message come out
All SDK package licenses accepted

C:\Users\karmadi>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Version 10.0.17763.973], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] VS Code (version 1.41.1)
[!] Connected device
! No devices available

! Doctor found issues in 1 category.

@whs-dot-hk
Copy link

whs-dot-hk commented Feb 15, 2020

I use sdkman

I can run flutter doctor --android-licenses successfully after running the command below and set it to default

$ sdk install java 8.0.242.j9-adpt

Downloading: java 8.0.242.j9-adpt

In progress...

############################################################################################################### 100.0%############################################################################################################### 100.0%

Repackaging Java 8.0.242.j9-adpt...

Done repackaging...

Installing: java 8.0.242.j9-adpt
Done installing!

Do you want java 8.0.242.j9-adpt to be set as default? (Y/n): 

Setting java 8.0.242.j9-adpt as default.

@almothafar
Copy link

almothafar commented Feb 16, 2020

@NatoBoram I think locking this ticket is better if there is no need for it for the future.

@darvela
Copy link

darvela commented Feb 20, 2020

Just run CMD as admin

@benedicte69
Copy link

I have accepted all the licences and suddenly they are 'forgotten'.....
Does anyone know how to solve this problem? Where does it come from? What is missing? What is the best way in 2020 to solve this problem?

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, v1.15.3, on Microsoft Windows [version 10.0.18363.657], locale fr-FR)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[√] Android Studio (version 3.5)
[√] Connected device (1 available)

flutter doctor --android-licenses
A newer version of the Android SDK is required. To update, run:
C:\xxxxx\tools\bin\sdkmanager --update

flutter doctor --android-licenses -v
A newer version of the Android SDK is required. To update, run:
C:\xxxxxx\tools\bin\sdkmanager --update

#0 throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1 AndroidLicenseValidator.runLicenseManager (package:flutter_tools/src/android/android_workflow.dart:365:7)
#2 Doctor.diagnose (package:flutter_tools/src/doctor.dart:245:38)
#3 DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:58:39)
#4 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:668:18)
#5 _rootRunUnary (dart:async/zone.dart:1134:38)
#6 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#7 _FutureListener.handleValue (dart:async/future_impl.dart:140:18)
#8 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#9 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#10 Future._completeWithValue (dart:async/future_impl.dart:526:5)
#11 Future._asyncComplete. (dart:async/future_impl.dart:556:7)
#12 _rootRun (dart:async/zone.dart:1126:13)
#13 _CustomZone.run (dart:async/zone.dart:1023:19)
#14 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#15 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:965:23)
#16 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#17 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#18 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#19 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

sdkmanager --update in a flutter app
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/X
mlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaMo
dule.java:156)
at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.
java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73

sdkmanager --update in an android app
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.(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

This is really a serious problem

@benedicte69
Copy link

@NatoBoram I think locking this ticket is better if there is no need for it for the future.

unfortunately it is not the case...

@Herohtar
Copy link

@benedicte69 Have you read through this thread and tried any solutions? Specifically, have you tried the solution listed here?

@GuilhermeEsdras
Copy link

I set the JAVA_HOME with the JRE in the Android studio and then flutter doctor --android-licenses just worked. For me, the JRE path was C:\Program Files\Android\Android Studio\jre

THANK YOU!!!!!!!

@benedicte69
Copy link

benedicte69 commented Feb 23, 2020

Congrats and many thanks @GuilhermeEsdras ! That is the most update answer I have read until now! For sure Gradlew will not complain about any bad JAVA_HOME that way.
It solved my android licenses (despite a wraning : .android\repositories.cfg could not be loaded.)

@Shivansh1200
Copy link

please help me out...
thing happens with me is-

$ flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.17763.1098], locale en-IN)
• Flutter version 1.12.13+hotfix.8 at C:\Users\asus\Desktop\flutter_windows_v1.12.13+hotfix.8-stable\flutter
• Framework revision 0b8abb4 (5 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced
• Dart version 2.7.0

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\asus\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-R, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.

[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.43.0)
• VS Code at C:\Users\asus\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.8.1

[!] Connected device
! No devices available

! Doctor found issues in 2 categories.

@futurechallenger
Copy link

futurechallenger commented Mar 15, 2020

I have the same issue.

Just open android studio and get the sdk manager installed.
Rerun the flutter doctor. It will tell you to accept the unaccepted android licenses.

@vkpdeveloper
Copy link

If you want to fix this problem then simply download Android Studio 3.5.2 from this link Download Android Studio 3.5.3 and then install it after removing the android studio that you have installed in your system. After installing it open it and do the same as you do with other android studio versions means install all the SDKs and just open cmd and hit flutter doctor and now android studio license status unknown error fixed.

Thanks!

@maheshmnj
Copy link
Member

maheshmnj commented Mar 16, 2020

For those who are still facing the issue and 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)
4. check it and apply and let the studio download the package
5. 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

for more detailed answer please see this answer https://stackoverflow.com/a/60705505/8253662 hope this helps

@Shivansh1200
Copy link

Shivansh1200 commented Mar 16, 2020 via email

@ShineSalt
Copy link

Have Android ASK (Obsolete)
image

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

D:\flutter\bin>C:\Users\sunuw\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
Warning: Could not create settings
java.lang.IllegalArgumentException
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.(SdkManagerCliSettings.java:428)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Usage:
sdkmanager [--uninstall] [] [--package_file=] [...]
sdkmanager --update []
sdkmanager --list []
sdkmanager --licenses []
sdkmanager --version

With --install (optional), installs or updates packages.
By default, the listed packages are installed or (if already installed)
updated to the latest version.
With --uninstall, uninstall the listed packages.

<package> is a sdk-style path (e.g. "build-tools;23.0.0" or
         "platforms;android-23").
<package-file> is a text file where each line is a sdk-style path
               of a package to install or uninstall.
Multiple --package_file arguments may be specified in combination
with explicit paths.

With --update, all installed packages are updated to the latest version.

With --list, all installed and available packages are printed out.

With --licenses, show and offer the option to accept licenses for all
available packages that have not already been accepted.

With --version, prints the current version of sdkmanager.

Common Arguments:
--sdk_root=: Use the specified SDK root instead of the SDK
containing this tool

--channel=<channelId>: Include packages in channels up to <channelId>.
                       Common channels are:
                       0 (Stable), 1 (Beta), 2 (Dev), and 3 (Canary).

--include_obsolete: With --list, show obsolete packages in the
                    package listing. With --update, update obsolete
                    packages as well as non-obsolete.

--no_https: Force all connections to use http rather than https.

--proxy=<http | socks>: Connect via a proxy of the given type.

--proxy_host=<IP or DNS address>: IP or DNS address of the proxy to use.

--proxy_port=<port #>: Proxy port to connect to.

--verbose: Enable verbose output.
  • If the env var REPO_OS_OVERRIDE is set to "windows",
    "macosx", or "linux", packages will be downloaded for that OS.
    image

@ibnu-ja
Copy link

ibnu-ja commented Mar 20, 2020

I'm using this solution but looks like flutter still looking for android/tools directory
Tried to symlink the directory, doesn't work
If I'm install cmdtools with android/tools directory, it would give error like this
Warning: Could not create settings java.lang.IllegalArgumentException

image

can somebody elaborate?

@thisisibini
Copy link

Android SDK Manager Tool is missing from new android studio build. !!!

@levkar
Copy link

levkar commented Apr 9, 2020

Android SDK Manager Tool is missing from new android studio build. !!!

Go to Tools -> SDK Manager -> SDK Tools
Select & install SDK Tools

@thisisibini
Copy link

thisisibini commented Apr 9, 2020 via email

@almothafar
Copy link

Unsubscribe...

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@lock lock bot locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging a pull request may close this issue.