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
01
local.properties is missing after a clone
“Sets the path to the SDK installation directory.” Android Developers, Environment 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\\Sdk02
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
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-tools03
An old ANDROID_SDK_ROOT that disagrees
“ANDROID_SDK_ROOT, which also points to the SDK installation directory, is deprecated.” Android Developers, Environment 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.
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 : Android Developers: Environment variables (ANDROID_HOME); React Native: Set Up Your Environment (Android).
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA 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
Related: Gradle “Could not resolve all files” · Android “Execution failed for task” · Android “Duplicate class found in modules”