[Fixed] I am getting error "cmdline-tools component is missing" after installing Flutter and Android Studio… I added the Android SDK. How can I so – Android

Photo of author
Written By M Ibrahim
android android-studio flutter flutter-doctor

The Problem:

An Android developer encountered an error message while setting up Android Studio for mobile app development. The error message states that the "cmdline-tools component is missing" and suggests running a command to install it. The developer seeks assistance in resolving this issue.

The Solutions:

Solution 1: Android Studio SDK Manager

  1. Open Android Studio and access the SDK Manager.
  2. Select the ‘SDK Tools’ tab.
  3. Check the checkbox for ‘Android SDK Command-line Tools (latest)’.
  4. Click ‘Apply’ to apply the changes and install the command-line tools.

Remember to include the tools and platform-tools directories within your SDK in your PATH environment variable.

Solution 2: Use Android Studio SDK Manager

If your Android Studio starting screen appears different, try this solution:

  1. Open Android Studio and click ‘more actions‘, located at the bottom of the welcome screen.
  2. Select ‘SDK Manager‘.
  3. In the ‘Preferences‘ window, navigate to the ‘SDK Tools‘ tab.
  4. Check the ‘Android SDK Command-line Tools (latest)‘ checkbox.
  5. Click ‘Apply‘ to save changes.

With this method, you can install the missing ‘cmdline-tools’ component through Android Studio’s built-in SDK Manager.

Solution 3: Installing Tools from SDK Manager

Open the SDK Manager by running the following command in your terminal:

sdkmanager

In the SDK Manager, navigate to the "SDK Tools" tab.

Locate and select the "Android SDK Command-line Tools" component.

Click the "Install" button to install the component.

Once the installation is complete, restart Android Studio.

Solution 4: Open SDK Manager

  1. Open SDK Manager from Android Studio.

  2. You can find the location from the menubar → Tools → SDK Manager or use the icon.

  3. Go to the SDK Tools tab.

  4. Select Android SDK Command Line Tools as shown in the image.

  5. Click on <kbd>Apply</kbd>.

  6. Run flutter doctor again in the terminal.

Solution 5: Install Android SDK Command-line Tools in Android Studio

To install the Android SDK Command-line Tools in Android Studio, follow these steps:

  1. Open Android Studio and go to Preferences Appearance & Behavior System Settings Android SDK SDK Tools.
  2. In the SDK Tools tab, select the Android SDK Command-line Tools (latest) checkbox.
  3. Click Apply and then OK.

After following these steps, the Android SDK Command-line Tools will be installed in Android Studio. You can verify this by running the following command in your terminal:

flutter doctor

If the command-line tools are installed correctly, you should see a message similar to the following:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
[✓] Connected device (2 available)

• No issues found!