“Android license status unknown” in flutter doctor

爷,独闯天下 提交于 2020-05-14 13:56:33

问题


I am getting an error with Android Sdk when I run flutter doctor on command-line

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.4.9-hotfix.1, on Mac OS X 10.14.4 18E226, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    ✗ Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit
      https://flutter.io/setup/#android-setup for detailed instructions.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2)
[✓] Android Studio (version 3.3)
[✓] VS Code (version 1.33.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

After following several possible fixes from the stackoverflow community, i still couldn't get it to work. Please i need assistance.


回答1:


Here's what worked for me

Fix 1:

  • Launch Android studio & Open the SDK manager (Top-right of Android studio)
  • Navigate to SDK Tab and look for Android SDK Platform-Tools
  • If it's checked, unchecked it and click 'Apply' (We're trying to uninstall the previous version)
  • Now the "SDK Tools" is uninstalled. Let's re-install it by checking the box and clicking 'Apply'
  • Hit Ok & Restart Android studio
  • Navigate to SDK install location at %USERPROFILE%\AppData\Local\Android\Sdk for windows, you should see a new folder tools Note: If you don't see the tools folder don't panic, i got you covered.
  • Open the tools folder & navigate to bin
  • Copy the folder path (i.e C:\Users\USERNAME%\AppData\Local\Android\Sdk\tools\bin)
  • Add that path to Environmental variables
  • Now you should have access to sdkmanager in the command-line. Try it out by typing sdkmanager & hitting enter in CMD.
  • If you get 'sdkmanager' is not recognized as an internal or external command, operable program or batch file. you probably made a mistake while adding the path to System Environmental Variables. Fix that.
  • Go to Flutter sdk folder (i.e c:/src/flutter) & launch the flutter_console.bat file
  • Now type the command flutter doctor --android-licenses and it should work. Accept all by typing y and hitting ENTER
  • And don't forget to run flutter doctor

Fix 2:

PS: Only if Fix 1 does not work for you!

  • Open your browser & goto Command line tools only (bottom of the page)
  • Download the appropriate package for your platform
  • Unzip it & Yes! You should see the tools folder
  • After extraction, copy the tools folder to C:\Users\USERNAME%\AppData\Local\Android\Sdk

    Now the same as Fix 1 above,

  • Open the tools folder & navigate to bin

  • Copy the folder path (i.e C:\Users\USERNAME%\AppData\Local\Android\Sdk\tools\bin)
  • Add that path to Environmental variables
  • Now you should have access to sdkmanager in the command-line. Try it out by typing sdkmanager & hitting enter in CMD.
  • If you get 'sdkmanager' is not recognized as an internal or external command, operable program or batch file. you probably made a mistake while adding the path to System Environmental Variables. Fix that.
  • NO you're not done
  • The SDK Platform tools you downloaded is probably outdated (as you can see when you run the sdkmanager command from the command-line)
  • Now let's handover to Android Studio to do the rest. Restart Android Studio, so it can recognize the tools folder you added.
  • After Restart, Android Studio should automatically detect the outdated Platform-tools and prompt you to update (You must be connected to the internet!).
  • IF UPDATE PROMPT DOES NOT SHOW UP
  • Open SDK Manager in Android studio,
  • Go to UPDATES
  • Click Check Now
  • And you should get the PROMPT to update Platform-Tools

Fix 3:

  • Do everything in Fix 2
  • Open Environmental Variables, Create a new Variable JAVA_HOME and set the value to the JRE/bin (get it from Android studio install location in Program Files)
  • Open the command line type set JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee' for windows & export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee' for Linux

And that's it you can now run flutter doctor --android-licenses on the command-line; Accept all licenses by typing y and hitting ENTER. And don't forget to run flutter doctor

THAT'S THE FIX. I HOPE IT WORKS FOR YOU TOO



来源:https://stackoverflow.com/questions/60869110/android-license-status-unknown-in-flutter-doctor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!