Unable to locate the Android SDK

Viewed 44456

I already had Android Studio and the Android SDK installed. I later added Flutter and the Flutter SDK. Here is my problem: When I run

flutter doctor

It shows,

Enter image description here

that I do not have the Android SDK installed.

5 Answers

You can configure the Android SDK for your project using

flutter config --android-sdk /path/to/android/sdk

The PATH variable also should contain the SDK, like

export PATH=$PATH:/usr/local/opt/android-sdk/emulator:/usr/local/opt/android-sdk/build-tools/26.0.1:/usr/local/opt/android-sdk/platform-tools:/usr/local/opt/android-sdk/tools

/usr/local/opt/android-sdk and 26.0.1 might not match your system. That's just an example.

Step-by-step guidance for Windows with pictures

Step 1.

Some screenshot

If you see this error, it means Flutter does not locate your Android SDK.

There are two folders containing all files of the "Android SDK". They are "Platform" and "Platform Tools":

Some screenshot

Those folders are located in my computer here:

C:\Users\ZohaibSaleem\AppData\Local\Android\Sdk

(My name is Zohaib Saleem, and you should replace my username folder name with your computer username.)

Step 2

Type "Env" in the search bar of Windows

Some screenshot

Click on "System Variable Environment"

Some screenshot

Click on "Advanced and Environment Variable"

Some screenshot

Go to System Variable → Path → Edit:

Some screenshot

Now paste the path of both folder "platform" and "platform-tools", respectively.

In my case, the paths are:

C:\Users\ZohaibSaleem\AppData\Local\Android\Sdk\platforms
C:\Users\ZohaibSaleem\AppData\Local\Android\Sdk\platform-tools

After adding the path to your System variable it looks like:

Some screenshot

Click OK

Restart PowerShell and again run the command "flutter doctor".

Now, the Android SDK problem is resolved, but you faced another problem:

Some screenshot

To resolve this issue, just run the command

flutter doctor --android-licenses

And accept all with "Y". At the end, after typing multiple 'Y's, again run 'flutter doctor' and all is set!

Some screenshot

flutter config --android-sdk /your path

example

flutter config --android-sdk /root/Android/Sdk

Tools > SDK Manager > Android SDK

images

Locate the Android SDK folder (e.g., D:\SDK).

Add platforms (D:\SDK\platforms) and platform-tools (D:\SDK\platform-tools) to the PATH variable.

Run flutter doctor. It should not show any errors or warnings.

For this issue you have to add three variables to the Path in the:

  1. C:\Users\admin\AppData\Local\Android\platforms // The path to platform

  2. C:\Users\admin\AppData\Local\Android\platform-tools // The path to platform-tool

  3. C:\Users\Admin\AppData\Local\Android\emulator // The path to emulator

Related