# Android: “SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project’s local properties file”

> Gradle says SDK location not found: it can’t find the Android SDK. Set sdk.dir in local.properties or ANDROID_HOME, for React Native, Flutter and CI.

Canonical: https://app369.com/fix/android-sdk-location-not-found/
Last updated: 2026-11-08

The Android build stops before it compiles anything, because Gradle doesn’t know where the Android SDK is installed. It shows up on a fresh clone of a React Native, Expo prebuild or Flutter project, on a new laptop, and on CI. The project is fine; the machine just hasn’t told Gradle where the SDK lives.

**Short answer**

Find the SDK path (Android Studio, Settings, Languages & Frameworks, Android SDK; on a Mac it is usually ~/Library/Android/sdk). Then either create android/local.properties with sdk.dir pointing to it, or set ANDROID_HOME in your shell profile and open a new terminal. Don’t commit local.properties: it holds a path that only fits your machine. On CI, set ANDROID_HOME in the job instead.

## **Why Gradle can’t find the SDK, and the fix**

1. 01 ### **local.properties is missing after a clone**
  > “Sets the path to the SDK installation directory.” [**Android Developers, Environment variables**](https://developer.android.com/tools/variables) Android Studio writes local.properties when it opens the project, and .gitignore keeps it out of the repo. A fresh clone built from the terminal has no file. Create it in the android folder for React Native and Flutter (the project root for a plain Android app), not the repo root. On Linux the SDK is usually in ~/Android/Sdk.```
# android/local.properties (macOS)
sdk.dir=/Users/YOUR_NAME/Library/Android/sdk

# Windows: escape the backslashes
sdk.dir=C\:\\Users\\YOUR_NAME\\AppData\\Local\\Android\\Sdk
```
2. 02 ### **ANDROID_HOME isn’t set in this shell**
  > “The React Native tools require some environment variables to be set up in order to build apps with native code.” [**React Native, Set Up Your Environment**](https://reactnative.dev/docs/set-up-your-environment) React Native and the command-line tools read ANDROID_HOME. Add it to ~/.zprofile or ~/.zshrc, then open a new terminal or run source. Check with echo $ANDROID_HOME. An editor or terminal opened before the change still has the old environment, and an IDE launched from the Dock or Start menu may not read your shell profile at all, so local.properties is the more reliable fix there.```
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
```
3. 03 ### **An old ANDROID_SDK_ROOT that disagrees**
  > “ANDROID_SDK_ROOT, which also points to the SDK installation directory, is deprecated.” [**Android Developers, Environment variables**](https://developer.android.com/tools/variables) Older guides set ANDROID_SDK_ROOT. If it points somewhere different from ANDROID_HOME, the build can fail or pick the wrong SDK. Remove ANDROID_SDK_ROOT, or set both to the same path.
4. 04 ### **Flutter, or a CI runner with no SDK** Flutter keeps its own setting: run flutter config --android-sdk with the path, then flutter doctor to confirm. Flutter writes sdk.dir into android/local.properties on the next build once it knows the path. On CI, use an image that has the Android SDK installed and set ANDROID_HOME in the job, rather than committing a local.properties with a path from your laptop.```
flutter config --android-sdk ~/Library/Android/sdk
flutter doctor -v
```

Checked against the vendor’s docs on November 8, 2026: [Android Developers: Environment variables (ANDROID_HOME)](https://developer.android.com/tools/variables); [React Native: Set Up Your Environment (Android)](https://reactnative.dev/docs/set-up-your-environment).

## **Rather hand it over?**

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

- [from $450**App Fix Ticket**One reproducible bug in an existing mobile or web app, diagnosed and fixed.**See scope and start**](https://app369.com/fixed-price/flutter-firebase-bug-fix/)
- [from $450**AI-Built App Rescue**A Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.****No issues worth fixing, no charge.**** If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.**See scope and start**](https://app369.com/fixed-price/ai-app-rescue/)

Related: [**Gradle “Could not resolve all files”**](https://app369.com/fix/android-gradle-could-not-resolve-all-files/) · [**Android “Execution failed for task”**](https://app369.com/fix/android-execution-failed-for-task/) · [**Android “Duplicate class found in modules”**](https://app369.com/fix/android-duplicate-class/)

Questions

## **More on this error**

<details>

<summary>**Should I commit local.properties? **+</summary>

No. It holds a path that only exists on your machine, and Android Studio regenerates it. Keep it in .gitignore and set ANDROID_HOME on other machines and on CI.

</details>

<details>

<summary>**I don’t have the SDK at all. What do I install? **+</summary>

Install Android Studio and let its setup download the SDK, or install the command-line tools on a build server. Then point sdk.dir or ANDROID_HOME at that folder.

</details>

<details>

<summary>**Can you fix it for me? **+</summary>

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

</details>

A different error?

## **Describe it and get a written quote**

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.

[**Describe your problem **→](https://app369.com/contact/) [**All fixes**](https://app369.com/fix/)