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

2,966

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.

Share:
2,966
Tamzid Ahmed
Author by

Tamzid Ahmed

Updated on December 17, 2022

Comments

  • Tamzid Ahmed
    Tamzid Ahmed over 1 year

    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?