SDK location not found
Error text
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.
Cause
Gradle does not know where the Android SDK is. local.properties is missing or ANDROID_HOME is not set.
Step-by-step fix
- Create a
local.propertiesfile in the project root. - Put an
sdk.dir=line with the full path of the SDK folder in it. - In a terminal also set
ANDROID_HOMEand addplatform-toolstoPATH. - If the SDK folder does not exist, install it with Android Studio's SDK Manager or use
sdkmanager. - After changing it, run
./gradlew --stopand build again.
Example commands
# local.properties (git-ə qoyma) sdk.dir=/home/user/Android/Sdk # Windows: sdk.dir=C\:\\Users\\user\\AppData\\Local\\Android\\Sdk export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin
How to prevent it
local.properties belongs to one computer. List it in .gitignore and never commit it.
Author and license: Nibras Code
- APK will not install
- What is a parse error?
- The keystore is lost
- The signatures do not match
- Package name error
- The APK file is damaged
- Play Protect blocks the app
- The package appears to be invalid
- Not enough storage
- The phone is not compatible
- An older version will not install
- XAPK will not install
- Gradle sync failed
- Could not resolve a dependency
- Duplicate class error
- Manifest merger failed
- Dex limit: 65536 methods
- R8: Missing class
- JDK version mismatch
- minSdkVersion conflict
- compileSdk is too low
- EAS build: Gradle failure
- expo prebuild error
- Metro: Unable to resolve module
- Hermes: JS error only in release
- White screen in release
- Red screen: cannot reach Metro
- Expo SDK mismatch
- Capacitor sync error
- Capacitor: white screen
- EAS: keystore and credentials error
- Keystore was tampered with / wrong password
- Wrong key alias or password
- Play: signed with the wrong key
- INSTALL_FAILED_UPDATE_INCOMPATIBLE
- INSTALL_FAILED_VERSION_DOWNGRADE
- INSTALL_FAILED_INSUFFICIENT_STORAGE
- INSTALL_FAILED_NO_MATCHING_ABIS
- Parse error (problem parsing the package)
- "App not installed" error
- Installing an AAB file on a phone
- adb: device "unauthorized"
- adb: device not found
- adb server version mismatch
- Activity class does not exist
- Play: targetSdk level too low
- Play: permissions policy rejection
- Play: 64-bit requirement
- Play: versionCode already used
- ClassNotFound / NoSuchMethod crash
- OutOfMemoryError crash
- CLEARTEXT communication not permitted
- SecurityException: permission denied