Android SDK Location Not Found: Fix sdk.dir in local.properties
SDK location not found means the Android build cannot resolve a usable Android SDK location in the environment where Gradle is running. First prove the SDK exists on that machine/runner, then identify whether this build should use project-local sdk.dir or an environment-provided SDK location. Do not install random SDK packages or edit Gradle dependencies until location discovery works.
SDK location not found.The project was cloned, moved to another machine, or opened outside Android Studio.The Android SDK is installed but the project cannot locate it.Find the Android SDK on the same machine, container or CI runner that reports the error. For a local Android Studio build, compare SDK Manager with the project root local.properties. For CI/headless builds, inspect the runner's configured SDK environment rather than copying a developer workstation path.
sdk.dir=/absolute/path/to/Android/SdkVerify: The path exists inside the failing environment and is an Android SDK root (for example it contains SDK component directories such as platform-tools or platforms). Only then choose the appropriate way to expose that path to the build.
Common SDK locations to check
Android Studio commonly uses
%LOCALAPPDATA%\Android\Sdk. Confirm it in SDK Manager instead of assuming.A common location is
~/Library/Android/sdk.A common location is
~/Android/Sdk.Treat these as common defaults, not proof. Android Studio’s SDK Manager is the authoritative location on your machine.
Why this happens
Android build tooling needs to discover an installed SDK root. For local projects, local.properties can hold machine-local sdk.dir. Automated/headless environments commonly expose the SDK through their environment configuration. These are location mechanisms, not substitutes for actually installing the SDK or its required components.
Diagnose before changing more
Use Android Studio SDK Manager or your known SDK location before editing paths.
Absolute SDK paths are machine-specific and commonly break after cloning or moving projects.
Create it in the project root only after you know the correct local SDK path.
Do not copy a host/developer absolute path into a runner/container where that filesystem path does not exist.
local.properties uses Java-properties syntax. Prefer a representation known to parse correctly, such as forward slashes in the Windows path, rather than blindly pasting unescaped backslashes.
That proves SDK location discovery progressed. Diagnose the newly named component/version instead of continuing to edit sdk.dir.
Fix #2 — write the correct sdk.dir for this machine
Set sdk.dir in the root local.properties file to the actual SDK directory. Use the path format appropriate for your operating system.
# macOS example
sdk.dir=/Users/you/Library/Android/sdk
# Windows example using forward slashes
sdk.dir=C:/Users/you/AppData/Local/Android/SdkVerify: Sync or rerun the failed Gradle task. If the build moves past “SDK location not found,” the path issue is fixed even if a new, unrelated build error appears.
Fix #3 — CI/headless: expose the SDK in the runner, not a developer path
For a CI runner, container or other headless environment, first ensure the SDK is installed/mounted in that environment and set its supported SDK-location environment configuration (normally ANDROID_HOME) to that runner-side SDK root. Do not generate a local.properties containing a workstation path unless your build intentionally manages a runner-local file.
./gradlew tasksgradlew.bat tasks.Verify: The Gradle wrapper should start configuration without the SDK-location error. On CI, verify the runner sees the intended SDK path before debugging project dependencies.
What not to do
Still seeing the error?
If the intended SDK root exists and the build still reports the same location error, compare the path as seen by the actual Gradle process: project root/local.properties for local builds, environment/mounts for CI or containers, and filesystem permissions where relevant. If the error changes to a named SDK component/version, SDK location is no longer the failing stage.
References and related guides
Still stuck? Ask the community
Share your operating system, software version, exact error text, and which fix you already tried. Another reader may have seen the same setup.
Loading community discussion…
Comments could not load here. Open ErrorHarbor Discussions on GitHub →