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 · 93 comments

Comments

Projects
None yet
@NatoBoram
Copy link

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.

neofetch
            .-/+oossssoo+/-.               n.gendron@atelier02-570f 
        `:+ssssssssssssssssss+:`           ------------------------ 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 16.04.4 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Kernel: 4.13.0-38-generic 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Uptime: 17 hours, 31 mins 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Packages: 3069 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Shell: bash 4.3.48 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Resolution: 1024x768, 1920x1080 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   DE: GNOME 3.18.5 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: GNOME Shell 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM Theme: Adwaita 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Theme: Greybird [GTK2/3] 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Icons: Elementary-xfce-darker [GTK2/3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    CPU: Intel i5 660 (4) @ 2.035GHz 
  +sssssssssdmydMMMMMMMMddddyssssssss+     GPU: NVIDIA GeForce 8400 GS Rev. 2 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      Memory: 4576MiB / 7840MiB 
    .ossssssssssssssssssdMMMNysssso. 
      -+sssssssssssssssssyyyssss+-                                 
        `:+ssssssssssssssssss+:` 
            .-/+oossssoo+/-. 
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)
@lukef

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Mar 28, 2018

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

This comment has been minimized.

Copy link

commented Mar 29, 2018

Me too, i have tried installing Android sdk 27.0.3

@Zedonboy

This comment has been minimized.

Copy link

commented Mar 29, 2018

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

This comment has been minimized.

Copy link

commented Mar 29, 2018

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Author

commented Mar 29, 2018

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Mar 30, 2018

@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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link

commented Mar 30, 2018

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

@Herohtar

This comment has been minimized.

Copy link

commented Mar 31, 2018

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

@MoltenFiber

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Contributor

commented Apr 4, 2018

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

@tvolkert tvolkert reopened this Apr 4, 2018

@tvolkert

This comment has been minimized.

Copy link
Contributor

commented Apr 4, 2018

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

@AmineMersoul

This comment has been minimized.

Copy link

commented Apr 6, 2018

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Apr 6, 2018

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

@tvolkert

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link

commented Apr 8, 2018

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

This comment has been minimized.

Copy link
Contributor

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...

@Herohtar

This comment has been minimized.

Copy link

commented Jan 29, 2019

@NatoBoram I'm on Windows, so it's a slightly different string, but even using the Windows version of that variable doesn't work -- I get the same java.lang.module.FindException: Module java.se.ee not found error that @ron-wolf mentions.

The only thing that ever worked for me was locally applying @lukef's patch, which apparently got reverted due to some other errors it caused.

However, so far I haven't run into any issues because of that warning and I've given up and just leave it alone... it's still annoying to not see all green when running flutter doctor though...

@leapit

This comment has been minimized.

Copy link

commented Feb 26, 2019

Not work,Mac os with java 11,and reinstalled Android Studio,latest flutter,got error

java.lang.module.FindException: Module java.se.ee not found

I already searched stackoverflow and flutter issues,loop with several possible solutions,but return back again. #28504

@NatoBoram

This comment has been minimized.

Copy link
Author

commented Feb 26, 2019

@leapit That's because Flutter uses sdkmanager, which uses Java 8, while Java 10 has java.se.ee deprecated.

You need to edit ~/Android/Sdk/tools/bin/sdkmanager and change DEFAULT_JVM_OPTS to

DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee

That makes sdkmanager able to run without errors

If that still doesn't work, then downgrade to Java 8 to accept licenses, then switch back to Java 11.

You can also try to run sdkmanager manually with Java 8, accept licenses, then Flutter should detect them as accepted. On linux, it's at ~/Android/Sdk/tools/bin/sdkmanager by default. You can add $HOME/Android/Sdk/tools/bin/ to your path to call it with sdkmanager.

@leapit

This comment has been minimized.

Copy link

commented Feb 27, 2019

@NatoBoram that's quite clear,thanks,finally i installed java 8,and accept the license solved this issue

@NatoBoram

This comment has been minimized.

Copy link
Author

commented Feb 27, 2019

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.

@knightcube

This comment has been minimized.

Copy link

commented Feb 28, 2019

After everything failed, I just downloaded jdk 8. Updated my JAVA_HOME environment variable to jdk 8 and then ran flutter doctor --android-licenses. It worked

@Herohtar

This comment has been minimized.

Copy link

commented Mar 2, 2019

Thank you, @NatoBoram! That finally solved it for me!

Here are the details for anyone running on Windows (at least, this is what worked for me on Windows 10).

On Windows, Android Studio includes an embedded version of the JDK. If you look at the JDK Location setting, the recommended option is to use that one instead of using your own installed version. The path listed when using the embedded option on my system was C:\Program Files\Android\Android Studio\jre.

So I just added a definition for JAVA_HOME to the file %LOCALAPPDATA%\Android\sdk\tools\bin\sdkmanager.bat so the relevant section now looks like this:

@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:\Program Files\Android\Android Studio\jre"
set DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0\.."

I was then able to run flutter doctor --android-licenses to accept the missing licenses and the output of flutter doctor no longer shows an error!

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v1.2.1, on Microsoft Windows [Version 10.0.17763.316], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.3)
[√] VS Code (version 1.31.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.
@bikramtpa

This comment has been minimized.

Copy link

commented Mar 4, 2019

it may happen that you accept all licenses agreement and shows 100% completed then run again
$ flutter doctor
it shows the same un agreed messages. the problem might be some of the android files needs Sudo access, because it's not able to update the agreed licenses, however quick hack is
chmod 755 -R ANDORID_ROOT_PATH
This is for linux, But this is a new case outside the main topic but related to the topic.

@Jasonlhy

This comment has been minimized.

Copy link

commented Mar 29, 2019

It seems to fix for me on Windows

If you like powershell

$ENV:JAVA_HOME="C:\Program Files\Java\jdk1.8.0_181"
$ENV:JAVA_OPTS="-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee"
$ENV:DEFAULT_JVM_OPTS='"-Dcom.android.sdlib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions'

If you like cmd

set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_181"
set JAVA_OPTS="-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee"
set DEFAULT_JVM_OPTS='"-Dcom.android.sdlib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions'
@akshaybengani

This comment has been minimized.

Copy link

commented Apr 3, 2019

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/

export don't work in windows, What should I do in windows for exporting path

@NatoBoram

This comment has been minimized.

Copy link
Author

commented Apr 3, 2019

@knightcube Have you tried #16025 (comment)?

@akshaybengani That was already answered by both #16025 (comment) and #16025 (comment).

@bikramtpa

This comment has been minimized.

Copy link

commented Apr 3, 2019

@akshaybengani - environmental variables in windows

@csobeski

This comment has been minimized.

Copy link

commented Apr 4, 2019

On a Mac, if you have Android Studio installed, you can just point JAVA_HOME to its Java. Run flutter doctor with the android-licenses parameter and accept all licenses when prompted.

export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"
flutter doctor --android-licenses
flutter doctor
@guiguan

This comment has been minimized.

Copy link

commented Apr 8, 2019

I had to use JDK 10:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
/Users/guiguan/Library/Android/sdk/tools/bin/sdkmanager --update
flutter doctor --android-licenses
@shabeer3508

This comment has been minimized.

Copy link

commented Apr 9, 2019

in my case had to downgrade my java version 12 to 8.it solved the problem.
try downgrade java

@JserJser

This comment has been minimized.

Copy link

commented Apr 12, 2019

I solved this problem.

My OS is Windows 10.

Worked Android Studio:

1.Android SDK Tools 25.0.2 uninstall.

2.Android SDK Tools 26.1.1 install.

C:\Users\leekabyeon\dart\flutter>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel origin/master, v1.1.6-pre.11, on Microsoft Windows [Version 10.0.17763.195], locale ko-KR)
[!] Android toolchain - develop for Android devices (Android SDK version 27.0.3)
	X Android license status unknown.
[!] Android Studio (version 3.2)
	X Flutter plugin not installed; this adds Flutter specific functionality.
	X Dart plugin not installed; this adds Dart specific functionality.
[√] IntelliJ IDEA Ultimate Edition (version 2018.3)
[√] VS Code (version 1.30.1)
[!] Connected device
	! No devices available
C:\Users\leekabyeon\AppData\Local\Android\sdk\tools\bin\sdkmanager --licenses
Error: Unknown argument --licenses
Usage:
  sdkmanager [--uninstall] [<common args>] \
	[--package_file <package-file>] [<packages>...]
  sdkmanager --update [<common args>]
  sdkmanager --list [<common args>]

In its first form, installs, or uninstalls, or updates 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.
In its second form (with --update), currently installed packages are
	updated to the latest version.
In its third form, all installed and available packages are printed out.
C:\Users\leekabyeon\dart\flutter>C:\Users\leekabyeon\AppData\Local\Android\sdk\tools\bin\sdkmanager --licenses
All SDK package licenses accepted.======] 100% Computing updates...
C:\Users\leekabyeon\dart\flutter>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel origin/master, v1.1.6-pre.11, on Microsoft Windows [Version 10.0.17763.195], locale ko-KR)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (version 3.2)
	X Flutter plugin not installed; this adds Flutter specific functionality.
	X Dart plugin not installed; this adds Dart specific functionality.
[√] IntelliJ IDEA Ultimate Edition (version 2018.3)
[√] VS Code (version 1.30.1)
[!] Connected device
	! No devices available

我按照你的方法解决了这个Bug,不过有些不一样的事情的,我有进行tools的拷贝。

@JserJser

This comment has been minimized.

Copy link

commented Apr 12, 2019

给大家看看我解决的办法
image
image
image
我就直接把c盘中的那个tools拷贝到了d盘软件sdk目录下面
image
再次运行,他会有一个是否接受这个licences
点击y就行
image
大家还可以看我的博客哇:https://www.cnblogs.com/smart-girl/p/10694891.html

@NatoBoram

This comment has been minimized.

Copy link
Author

commented Apr 12, 2019

I think it's time to close this issues. The original issue was about Java being a dick and not using my work company's proxy, but I have since changed workstation with a different proxy configuration. I should have closed this issue back then.

Specifically, my issue was this :

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.

The problem that most people are encountering is about SDKManager using an outdated version of Java, and a fix for that problem is #16025 (comment). New commenters are obviously people that don't care enough to fix their problem to read previous replies and use the provided solution, and I feel a bit insulted.

There were other problems in the meantime, but the Flutter team fixed them and I am grateful for that. However, the new problem is on Android Studio's part, not Flutter's part.

One thing they could do is to locate the Android Studio installation and temporarily set JAVA_HOME to Android Studio's Java installation. That would be a future-proof solution, but that doesn't fix the root problem.

@NatoBoram NatoBoram closed this Apr 12, 2019

@xiehubin

This comment has been minimized.

Copy link

commented Apr 15, 2019

i had the same problem. tried a lot but didn't fix it. last what i did is
$ANDROID_HOME/tools/bin/sdkmanager --licenses

@cvgaviao

This comment has been minimized.

Copy link

commented Apr 23, 2019

As I'm using JDK11, I needed to copy the missing libraries to /home/user/Android/Sdk/tools/lib.
I've downloaded them from maven central repository:

https://search.maven.org/remotecontent?filepath=com/sun/istack/istack-commons-runtime/3.0.8/istack-commons-runtime-3.0.8.jar
https://search.maven.org/remotecontent?filepath=org/glassfish/jaxb/jaxb-runtime/2.3.1/jaxb-runtime-2.3.1.jar
https://search.maven.org/remotecontent?filepath=com/sun/activation/javax.activation/1.2.0/javax.activation-1.2.0.jar
https://search.maven.org/remotecontent?filepath=javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar

and them called /home/cvgaviao/Android/Sdk/tools/bin/sdkmanager --update
and flutter doctor --android-licenses

@devlwkyan

This comment has been minimized.

Copy link

commented May 11, 2019

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

This solved my issues, thanks

@RaymondFontaine

This comment has been minimized.

Copy link

commented May 31, 2019

@devlwkyan When I type this, it says "Command not found"

raymondfontaine$ $flutter doctor --android-licenses
-bash: doctor: command not found
Raymonds-MacBook-Air:~ raymondfontaine$

What else can I do?

@kodaman2

This comment has been minimized.

Copy link

commented Jun 3, 2019

This works only if you have the correct sdk manager version, flutter doctor --android-licenses
if you don't it tells you how to update it, also the sdk manager version doesn't like java9 so I had to change my path to java8, updated sdk manager, and then did android licenses. Hit Yes on all prompts, and done.

@nahrepus

This comment has been minimized.

Copy link

commented Jun 6, 2019

$ flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 6.1. 7601], locale zh-CN) [!] Android toolchain - develop for Android devices (Android SDK version 29.0.0) X Android license status unknown. Try re-installing or updating your Android SDK Manager. See https://developer.android.com/studio/#downloads or visit https://flutt er.dev/setup/#android-setup for detailed instructions. [√] Android Studio (version 3.4) [!] IntelliJ IDEA Ultimate Edition (version 2018.3) X Flutter plugin not installed; this adds Flutter specific functionality. [!] Connected device ! No devices available ! Doctor found issues in 3 categories.

@nahrepus

This comment has been minimized.

Copy link

commented Jun 6, 2019

$ java -version java version "11.0.1" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

@nahrepus

This comment has been minimized.

Copy link

commented Jun 6, 2019

$ javac -version javac 11.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.