android - 错误: Unknown argument --licenses flutter doctor --android-licenses

标签 android linux bash flutter sdk

我尝试用vscode安装android SDK来编写flutter。但每当启动 Android 模拟器时,它都会要求许可证。但每当我使用命令 flutter doctor android 许可证时。它给了我这个错误。我正在使用,

ANDROID SDK 平台工具 - 29.0.6
ANDROID SDK 构建工具 - 29.0.3
ANDROID 7(API:24)

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.1, on Linux, locale en_US.utf8)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
[!] Android Studio (not installed)
[✓] VS Code (version 1.50.0)
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

我尝试了很多 StackOverflow 解决方案,但没有成功。也许已经过时了。

 flutter doctor --android-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.

Common Arguments:
    --sdk_root=<sdkRootPath>: 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.                                                                                                                                                             
                                                                                                                                                                                                                 
* If the env var REPO_OS_OVERRIDE is set to "windows",                                                                                                                                                           
  "macosx", or "linux", packages will be downloaded for that OS.   

那么如何激活android SDK的许可证呢?

最佳答案

当我运行flutter doctor --android-licenses时,我遇到了同样的问题。我在没有使用 Android Studio 的情况下安装了 android SDK。

这是我为使其发挥作用而采取的步骤

  1. 我去了android studio download page向下滚动并下载适用于我的操作系统(Windows)的命令行工具
  2. 然后我将其解压到android-sdk目录
  3. 我在 cmdline-tools 中创建了一个名为 latest 的新文件夹,并将 cmdline-tools 的内容移至其中。

此后,我尝试运行flutter doctor --android-licenses,然后它运行没有错误,并在我的设备上运行它没有问题。

关于android - 错误: Unknown argument --licenses flutter doctor --android-licenses,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64307347/

相关文章:

linux - bash:/bin/tar: 使用 tar 压缩许多文件时参数列表太长

bash - 为大量 BASH 脚本构建帮助菜单

android - 断开 MediaController 的正确方法是什么?

android - No IDEA annotations attached to the JDK 1.8 (C :\…), 有些问题会找不到

mysql - 共享服务器上mysql套接字的安全性

linux - Ubuntu 16.04 -(Python 的 Oracle 模块) - 如何安装 'cx_Oracle' 模块的简便方法?

android - 如何在 android 中的 Activity 启动时从 sharedpreference 加载语言?

机器人 : NestedScrollview bottom two button attached

linux - 根据时间启动和终止进程

java - Shell 脚本输出位于不同的目录中