SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable
Please follow below steps it work's for me:
- Go to your react-native Project then go to android directory Create a file with following name:
local.properties
- Open the file and paste your Android SDK path like below:
For windows users:
sdk.dir=C:\\Users\\UserName\\AppData\\Local\\Android\\sdk
Replace UserName with your pc user name . Also make sure the folder is sdk or Sdk. In my case my computer user name is Zahid so the path look like:
sdk.dir=C:\\Users\\Zahid\\AppData\\Local\\Android\\sdk
For Mac users:
sdk.dir = /Users/USERNAME/Library/Android/sdk
Where USERNAME is your OSX username.
For Linux (Ubuntu) users:
sdk.dir = /home/USERNAME/Android/Sdk
Where USERNAME is your linux username(Linux paths are case-sensitive: make sure the case of S
in Sdk
matches)
In case if this doesn't work, add ANDROID_HOME variable in "Environment Variables" as C:\Users\USER\AppData\Local\Android\Sdk
The project might be missing a settings.gradle
file. Make sure that file exists from the project you are importing. If not add the settings.gradle
file with the following :
include ':app'
Save the file and put it at the top level folder in your project.
I know this answer is late, but I hope it helps others.
The answer is simple. You have to just copy your local.properties
file to the folder where project is stored and it will work like charm. But remember, it must be placed in the root folder where the project is stored.