【问题标题】:Error: Unknown argument --licenses flutter doctor --android-licenses错误:未知参数--licenses颤振医生--android-licenses
【发布时间】:2021-01-26 03:31:18
【问题描述】:

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

ANDROID SDK 平台工具 - 29.0.6
ANDROID SDK 构建工具 - 29.0.3
安卓 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的许可呢?

【问题讨论】:

    标签: android linux bash flutter sdk


    【解决方案1】:

    我在运行 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,然后它可以正常运行,并且在我的设备上运行它也没问题。

    【讨论】:

      【解决方案2】:

      如果您的&lt;sdk&gt;/cmdline-tools\latest 目录中没有命令行工具,则会出现此问题。不用安装Android Studio,可以从here下载命令行工具,放到 &lt;sdk&gt;/cmdline-tools\latest目录下

      【讨论】:

        【解决方案3】:

        安装 Android SDK 6.0(Marshmallow)

        【讨论】:

          【解决方案4】:

          我通过安装 android studio 并卸载所有 android 文件并从 android studio 重新安装来解决它。然后自动在文件夹中创建许可证。现在,每当我从 vscode 运行模拟器时,它都能顺利运行。

          我遇到了这个问题,因为我直接从 android sdk 安装了所有 android 文件。我通过 sudo snap android-sdk 安装了 android sdk。所以它给我带来了问题。 要了解更多详细信息,您可以阅读这篇文章 - Flutter, Android SDK and VScode setup on Linux Complete Guideline

          【讨论】:

            猜你喜欢
            • 2021-08-12
            • 2021-08-19
            • 2021-11-07
            • 1970-01-01
            • 2019-07-03
            • 2020-09-27
            • 2021-08-11
            相关资源
            最近更新 更多