# SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in local.properties

**Code:** `SDK location not found` · **Category:** Android · **Seen on:** Android

Gradle doesn’t know where the Android SDK is installed.

## Meaning

local.properties (not committed) holds sdk.dir. Fresh clones, CI machines and command-line builds without ANDROID_HOME fail. React Native/Flutter projects hit it the same way.

## Common causes

- local.properties missing (fresh clone, CI)
- ANDROID_HOME/ANDROID_SDK_ROOT not set
- SDK not installed or moved

## Quick fix

1. Create local.properties with sdk.dir
2. Set ANDROID_HOME in your shell profile/CI
3. Install the SDK via Android Studio or sdkmanager

## Detailed fix by platform

### Shell

1. 

```kotlin
echo "sdk.dir=$HOME/Library/Android/sdk" > android/local.properties
export ANDROID_HOME=$HOME/Library/Android/sdk
```


## How to diagnose

1. **File** — local.properties present?
2. **Env** — echo $ANDROID_HOME
3. **SDK** — Folder exists?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/android/sdk-location-not-found)
