React Native android build failed. SDK location not found
I have error when i start running android
What went wrong:
A problem occurred evaluating project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
- Go to the
android/
directory of your react-native project - Create a file called
local.properties
with this line:
sdk.dir = /Users/USERNAME/Library/Android/sdk
Where USERNAME
is your macOS username
- Go to your React-native Project -> Android
- Create a file
local.properties
- Open the file
-
paste your Android SDK path like below
- in Windows
sdk.dir = C:\\Users\\USERNAME\\AppData\\Local\\Android\\sdk
- in macOS
sdk.dir = /Users/USERNAME/Library/Android/sdk
- in linux
sdk.dir = /home/USERNAME/Android/Sdk
- in Windows
Replace USERNAME
with your user name
Now, Run the react-native run-android
in your terminal.
You can try adding ANDROID_PATH
export ANDROID_HOME=/Users/<username>/Library/Android/sdk/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools