Flutter: cmdline-tools component is missing error [Solved]

“cmdline-tools component is missing” is an Error with android SDK configuration with flutter.

Run flutter doctor

It displays a report of the status of your flutter installation.

1. Solve cmdline-tools component is missing Error

Let’s use Android studio to solve this flutter error.

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    ✗ cmdline-tools component is missing
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

Android SDK cmdline-tools component is missing error could be shown on windows, mac, Linux, visual studio code and android studio.

How to Install command line-tools on Android Studio

1. Open Android Studio

Open Android Studio

2. Go to SDK Manager

SDK Manager

3. Switch to SDK Tools Tab

Go To SDK Tools

4. Check Android SDK Command-line Tools(latest)

Select Android Commandline tool

command-line tools Downloading Process

command-line tools will be downloaded from the internet and installed on your system.

Installation finished of cmdline flutter

How to Install command line-tools without Android Studio

If you want to download the command line-tool without using an android studio then go to this link

Here you can download the zip file of command line-tools

Move it to the home folder of your system

Create a directory to store the android studio and other stuff

open the terminal and write

~ $ mkdir android
~ $ cd android

Move and unzip the tools in the android directory we just created

~/android $ mv ~/commandlinetools-mac-6858069_latest.zip ./
~/android $ unzip commandlinetools-mac-6858069_latest.zip
~/android $ rm commandlinetools-mac-6858069_latest.zip

Of course, you will use your file names here

The directory acts as $ANDROID_HOME so other libraries can access it from the environment variable.

In the android directory run

$ cd cmdline-tools
$ mkdir tools
$ mv -i * tools

Add tools to $PATH and you configure your cmdline-tool.

2. Solve cmdline-tools component is missing Error

If your run flutter doctor and see this error

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/ADMIN/Library/Android/sdk
✗ cmdline-tools component is missing
  Run `path/to/sdkmanager --install "cmdline-tools;latest"`

Solution For Windows

/Users/YOURUSER/Library/Android/sdk/tools/bin/sdkmanager --install "cmdline-tools;latest"

Run this command on terminal

Note

Here path/to/sdkmanager was

/Users/YOURUSER/Library/Android/sdk/tools/bin/sdkmanager

Solution For Mac Users

Run this command in terminal

cd Library/Android/sdk/tools/bin
./sdkmanager --install "cmdline-tools;latest"

cmdline-tools component is missing Error solved flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.5.1 20G80 darwin-x64, locale
  en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.60.2)
[✓] Connected device (2 available)

• No issues found!

Conclusion

cmdline-tools is an Android SDK Tools Component that was missing. We solve the problem by using android studio and terminal.

Hussain Humdani

Hussain Humdani

while ( ! ( succeed = try() ) );