簡體   English   中英

錯誤:未知參數 --licenses flutter doctor --android-licenses

[英]Error: Unknown argument --licenses flutter doctor --android-licenses

我嘗試用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下載頁面並向下滾動並下載了我的操作系統(windows)的命令行工具
  2. 然后我解壓到android-sdk目錄下
  3. 我創建了一個名為新文件夾, latest內部cmdline-tools和移動的內容cmdline-tools吧。

在此之后,我嘗試運行flutter doctor --android-licenses然后它沒有錯誤地工作並且在我的設備上運行它沒問題。

如果<sdk>/cmdline-tools\\latest目錄中沒有命令行工具,則會出現此問題。 您可以從這里下載命令行工具,而不是安裝 Android Studio,並將其放在目錄<sdk>/cmdline-tools\\latest

安裝 Android SDK 6.0(Marshmallow)

我通過安裝 android studio 並卸載所有 android 文件並從 android studio 重新安裝來解決它。 然后自動在文件夾中創建許可證。 現在每當我從 vscode 運行模擬器時..它運行順利。

我遇到了這個問題,因為我直接從 android sdk 安裝了所有 android 文件。 我通過 sudo snap android-sdk 安裝了 android sdk。 所以它給我帶來了問題。 要了解更多詳細信息,您可以閱讀本文 - Linux 完整指南上的 Flutter、Android SDK 和 VScode 設置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM