Android许可状态的Flutter错误未知

时间:2019-08-22 12:09:10

标签: android android-studio flutter

我试图在Windows 10上运行Flutter,但出现一些错误。尝试解决错误“ Android许可证状态未知”。从最近几个小时开始。但是没有运气。我的系统环境如下:

  

Windows 10,Java版本“ 12.0.2”,2019年7月16日,Android Studio 3.5。

有人可以知道我在这里所缺少的吗?

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

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    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)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code, 64-bit edition (version 1.37.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

C:\Users\me>

我尝试了以下命令( flutter doctor --android-licenses ),并收到如下错误:

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



C:\Users\me>

4 个答案:

答案 0 :(得分:2)

您已经接受了许可证吗? 如果没有,请尝试

flutter doctor --android-licenses

How to accept Android licenses

所示

答案 1 :(得分:0)

实际上,不需要Android许可证。只需打开android studio并开始一个新的flutter项目即可,玩得开心!如果您想这样做。键入命令:flutter doctor --android-licenses 玩得开心!

答案 2 :(得分:0)

我解决了。我设置了JDK_HOME,然后运行以下命令进行修复:

flutter doctor --android-licenses

因此,基本上它无法配置JDK Home,并且发生了该错误。希望,如果您遇到此错误,它将解决问题。

答案 3 :(得分:0)

它对我有用。

因此,在此解决方案中,打开您的SDK管理器,然后取消选中Hide Obsolete Packages

enter image description here

现在,您会看到Android SDK Tools (Obsolete) 26.1.1出现。勾选该软件包并点击apply button,然后单击确定按钮。它将下载sdk。 然后restart Android Studio

很好,现在,如果您运行flutter doctor,则应获得如下肯定结果

PS D:\Workplace\flutter_projects> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.657], locale en-MY)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[√] VS Code (version 1.42.1)
[√] Connected device (1 available)

• No issues found!

PS D:\Workplace\flutter_projects> flutter doctor --android-licenses -v
All SDK package licenses accepted.======] 100% Computing updates...

运行flutter doctor --android-licenses并在出现提示时输入Y

引用-{https://robbinespu.gitlab.io/blog/2020/03/03/flutter-issue-fixed-android-license-status-unknown-on-windows/

如果需要,我们可以在https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip上手动下载软件包(对于Windows用户)。希望本教程对寻求解决方案的人有所帮助