Unable to locate android SDK for flutter doctor

Viewed 12312

I have tried uninstalling and reinstalling flutter on my computer twice but whenever I run flutter doctor in the terminal I am still met with the following error.

[āœ—] Android toolchain - develop for Android devices
āœ— Unable to locate Android SDK.
  Install Android Studio from:
  https://developer.android.com/studio/index.html
  On first launch it will assist you in installing the Android SDK
  components.
  (or visit https://flutter.dev/docs/get-started/install/macos#android-setup
  for detailed instructions).
  If the Android SDK has been installed to a custom location, set
  ANDROID_SDK_ROOT to that location.
  You may also want to add it to your PATH environment variable.

Does anyone know how to fix this problem? Also, could this be the reason that none of my emulators are running my app? Thanks, and sorry, I am still new to Flutter and android studio.

5 Answers

If it is unable to locate your Android SDK, the reason might be that your Android SDK path is not up to date.

I think your issue is similar to this: https://github.com/flutter/flutter/issues/45007.

Try flutter config --android-sdk <path-to-your-android-sdk-path> to update the Android SDK path.

This issue is related to environment variables.

After entering the environment variables, you have to click on the system variables and find the "Path" variable.

Double click on the "Path" variable and add a new one on the right.

There are two directories you need to add, "D: \ AndroidSDK \ platforms" and "D: \ AndroidSDK \ platform-tools".

These two directories can be in different places, remember this.

Faced the same issue when I moved my android studio to my external hard drive on my MacBook, here are steps I followed to fix

1 set the andriod sdk path flutter config --android-sdk example: flutter config --android-sdk /Volumes/Apps/Library/Android

Once done it showed another error: Android license status unknown. to fix this we need to add andriod studio directory, that is android studio app. Like this: flutter config --android-studio-dir example: flutter config --android-studio-dir /Volumes/Apps/Android\ Studio.app

finally access the licensed from android studio, using below command and your are done. flutter doctor --android-licenses

If you do for example:

flutter config --android-sdk C:\Users\User\AppData\Local\Android\Sdk

and nothing happen, it is normal you have to double backslash like this:

flutter config --android-sdk C:\\Users\\User\\AppData\\Local\\Android\\Sdk

For flutter 10.2.3 and Android Studio Bumblebee, I had to uninstall sdk using

File -> Settings > Appearance & Behavior -> system Settings -> Android SDK > SDK Platforms > uncheck all and apply.

After uninstall, I had remove to remaining contents in the Android SDK location manually.

Then install again

File -> Settings > Appearance & Behavior -> system Settings -> Android SDK > SDK Platforms > Check Android API 32 -> apply

Install in SDK Tools tab -> expand Android SDK Build Tools -> 32.0.0 and Android Command Line tools (latest)

Then set

flutter config --android-sdk "path to your sdk root"

Related