Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

flutter doctor cannot find the Android SDK

ErrorUnable to locate an Android SDK.

Short answer

Flutter looks for the SDK in a fixed order: its own android-sdk setting, then ANDROID_HOME, then ANDROID_SDK_ROOT, then the default folder for your system. The folder it finds must contain platform-tools or licenses. Point the setting at the right folder with flutter config --android-sdk.

  • Applies to Flutter 3.3x stable, Android SDK Platform-Tools and Command-line Tools, macOS 26, Ubuntu 24.04, Windows 11
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Show what Flutter has stored and what your shell exports. Because Flutter's own setting wins over the environment variables, a stale value here beats a correct ANDROID_HOME.

    flutter config
    echo "$ANDROID_HOME"
  2. 2Match what you see, then jump to its fix

    1. 1flutter config shows no android-sdk, ANDROID_HOME is empty, and the SDK sits in a custom folderThe SDK is not in the default folder and Flutter was never told where it isFix
    2. 2The path printed by flutter config or echo "$ANDROID_HOME" is a folder that moved, has a typo, or is not the SDKA stored android-sdk value or ANDROID_HOME points at the wrong folderFix
    3. 3Only ANDROID_SDK_ROOT is exported, and the SDK is in a custom folderYou still use ANDROID_SDK_ROOTFix
    4. 4The path is correct, yet neither platform-tools nor licenses exists inside itThe folder exists but is not a complete SDKFix

What does the error look like?

  • Unable to locate an Android SDK.

Cause 1 of 4

The SDK is not in the default folder and Flutter was never told where it is

1Check

The Flutter tool tries these default locations under your home folder: Android/Sdk on Linux, Library/Android/sdk on macOS, and AppData/Local/Android/sdk on Windows. Check whether yours is one of them.

ls ~/Library/Android/sdk      # macOS
ls ~/Android/Sdk              # Linux

2Fix

Tell Flutter the folder once. It stores the setting and uses it before any environment variable.

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

3Verify

Run doctor and read the Android toolchain line.

flutter doctor -v

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 4

A stored android-sdk value or ANDROID_HOME points at the wrong folder

1Check

Flutter's setting is read first, then ANDROID_HOME. A value that points to a folder without platform-tools and licenses is rejected, and Flutter falls through to its other searches.

ls "$ANDROID_HOME/platform-tools"
ls "$ANDROID_HOME/licenses"

2Fix

Correct the variable (Android's docs name ANDROID_HOME as the variable that sets the SDK directory) and the Flutter setting so that they name the same folder.

export ANDROID_HOME="$HOME/Library/Android/sdk"
flutter config --android-sdk "$ANDROID_HOME"

3Verify

doctor reports the SDK at that path.

flutter doctor -v

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 4

You still use ANDROID_SDK_ROOT

1Check

Android marks ANDROID_SDK_ROOT as deprecated in favour of ANDROID_HOME, and the Flutter tool reads it only after ANDROID_HOME and its own setting.

env | grep -i ANDROID

2Fix

Export ANDROID_HOME with the same value and add it to your shell profile (for example ~/.zprofile on macOS), then open a new terminal.

export ANDROID_HOME="$HOME/Library/Android/sdk"

3Verify

A new terminal prints the value and doctor finds the SDK.

echo "$ANDROID_HOME"
flutter doctor -v

Confirmed by developer.android.com

Did this fix it?

Cause 4 of 4

The folder exists but is not a complete SDK

1Check

In the Flutter source, a candidate folder counts as an Android SDK only if it has a licenses folder or a platform-tools folder.

ls /path/to/android/sdk

2Fix

Install the tools listed in Flutter's Android setup guide through Android Studio's SDK Manager: Build-Tools, Command-line Tools, Emulator, Platform-Tools, and the Platform for the current API level. Then accept the licenses.

# Android Studio: Tools > SDK Manager > SDK Tools
flutter doctor --android-licenses

3Verify

Doctor shows the Android toolchain without a red mark.

flutter doctor

Confirmed by docs.flutter.dev

Did this fix it?

How do I stop it coming back?

  • Install the Android SDK through Android Studio and keep it in its default folder.
  • Set ANDROID_HOME once in your shell profile and run flutter config --android-sdk with the same path.
  • After moving the SDK folder, update both places.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Gradle cannot find the Android SDK on this machine

FAILURE: Build failed with an exception. What went wrong: SDK location not found.

Gradle looks for the Android SDK in the sdk.dir line of android/local.properties and in the ANDROID_HOME environment variable, and found neither.

4 causes, each with a fix

Mobile apps

A phone is plugged in over USB but Android Studio and adb do not list it

adb devices prints List of devices attached with nothing below it

adb lists a phone only when four things hold: USB debugging is on, you accepted the computer's RSA key on the phone, the computer has a driver or udev rule for the device, and the cable carries data to a running adb server.

6 causes, each with a fix

Mobile apps

Flutter's Android build stops: JAVA_HOME is not set

ERROR: JAVA_HOME is set to an invalid directory

The Gradle wrapper script needs a Java runtime and looks in two places: the JAVA_HOME variable, then a java command on PATH.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.