• Register
0 votes
2.8k views

Problem :

I recently tried to import the sample Android games which I downloaded from Google's developer website. After importing them into my Android Studio, I am getting the below error:

Error: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

What is this error means? I want to run my sample programs from a Android Studio.

3.9k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

You need to just follow below steps it worked for me:

· Go to the react-native Project then go to the android directory Create the file with below name

local.properties

· Open a file and paste the Android SDK path as shown below :

For the windows users:

sdk.dir=C\:\\Users\\PcUserName\\AppData\\Local\\Android\\sdk

Replace the UserName with your pc user name . Also make sure that the folder is sdk or Sdk. In my case my computer user name is AbhijitJ so my path look like :

sdk.dir=C\:\\Users\\ AbhijitJ \\AppData\\Local\\Android\\sdk

For the Mac users:

sdk.dir = /Users/OSXUSERNAME/Library/Android/sdk

Where the USERNAME is your OSX username

For the Linux (Ubuntu) users:

sdk.dir = /home/LINUXUSERNAME/Android/Sdk

Where USERNAME is your linux username(Linux paths are very case-sensitive: make sure a case of S in Sdk matches)

In case if this doesn't work for you then add ANDROID_HOME variable in the "Environment Variables" as follows C:\Users\USER\AppData\Local\Android\Sdk

38.6k points