flutter doctor cannot find the Android SDK
Unable 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.
Fix it fast
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"2Match what you see, then jump to its fix
- 1
flutter 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
The 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
Only ANDROID_SDK_ROOT is exported, and the SDK is in a custom folderYou still use ANDROID_SDK_ROOTFix - 4
The path is correct, yet neither platform-tools nor licenses exists inside itThe folder exists but is not a complete SDKFix
- 1
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 # Linux2Fix
Tell Flutter the folder once. It stores the setting and uses it before any environment variable.
flutter config --android-sdk /path/to/android/sdk3Verify
Run doctor and read the Android toolchain line.
flutter doctor -vConfirmed by raw.githubusercontent.com
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 -vConfirmed by developer.android.com
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 ANDROID2Fix
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 -vConfirmed by developer.android.com
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/sdk2Fix
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-licenses3Verify
Doctor shows the Android toolchain without a red mark.
flutter doctorConfirmed by docs.flutter.dev
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
Related fixes
Mobile apps
flutter doctor says the Android cmdline-tools component is missing
Android license status unknown.
Flutter checks for a cmdline-tools folder inside the Android SDK it found, and stops the Android checks when that folder is absent.
6 causes, each with a fixMobile 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 fixMobile 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 fixMobile 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 fixMobile apps
flutter run hangs for minutes on Running Gradle task 'assembleDebug'
Downloading https://services.gradle.org/distributions/gradle-8.14-all.zip
That line only says Gradle started; the wait is inside Gradle.
3 causes, each with a fixMobile apps
flutter doctor cannot find the Java that comes with Android Studio
Unable to find bundled Java version.
Flutter looks for the Java inside Android Studio first, then JAVA_HOME, then any java on PATH.
3 causes, each with a fix