Tamzid Ahmed
Tamzid Ahmed

Reputation: 640

Error: Unknown argument --licenses flutter doctor --android-licenses

I tried to install the android SDK with vscode to write flutter. But whenever a start android emulator it asked for licenses. But whenever I use command flutter doctor android licenses. It gives me this error. I am using,

ANDROID SDK PLATFORM TOOLS - 29.0.6
ANDROID SDK BUILD TOOLS - 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.

I tried many StackOverflow solutions but it didn't work out. maybe outdated.

 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.   

So how can I activate the license for android SDK?

Upvotes: 2

Views: 3922

Answers (4)

user12152456
user12152456

Reputation:

I had the same issue when I ran flutter doctor --android-licenses. And I had android SDK installed without using Android Studio.

Here are the steps I took to make it work

  1. I went to android studio download page and scrolled down and downloaded the command line tools for my OS (windows)
  2. Then I extracted it to the android-sdk directory
  3. I created a new folder called latest inside cmdline-tools and moved the content of cmdline-tools to it.

After this I tried to run flutter doctor --android-licenses and then it worked without errors and ran it on my device no problem.

Upvotes: 4

Ratshiḓaho Wayne
Ratshiḓaho Wayne

Reputation: 743

This issue would occur if you do not have the command-line tools in your <sdk>/cmdline-tools\latest directory. Instead of installing Android Studio, you can download command line tools from here and put it in the directory <sdk>/cmdline-tools\latest

Upvotes: 0

Tamzid Ahmed
Tamzid Ahmed

Reputation: 640

I solved it by installing android studio and uninstall all android files and reinstall from android studio. Then automatically the license created in the folder. now whenever I run the emulator from vscode.. it is working smoothly.

I faced the problem because I installed all android files from android sdk directly. I installed android sdk by sudo snap android-sdk. so it created the problem for me. To know more in detailed you can read this article - Flutter, Android SDK and VScode setup on Linux Complete Guideline

Upvotes: 0

user14431854
user14431854

Reputation:

Install Android SDK 6.0(Marshmallow)

Upvotes: 0

Related Questions