Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I recently tried to import sample Android games I downloaded from Google's developer website. After importing them into Android Studio, I'm getting the following 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? I want to run the sample programs from Android Studio.

like image 969
Sameer Shamsudeen Avatar asked Dec 23 '14 12:12

Sameer Shamsudeen


People also ask

How do I fix SDK location not found?

Close the current project and you'll see a pop-up with a dialog which will then proceed to Configure option. Configure -> Project Defaults -> Project Structure -> SDKs on left column -> Android SDK Home Path -> give the exact path as you did on local. properties and select Valid Target.

How do you set the SDK Dir path in your project's local properties file?

Go to System Properties -> Environment Variables -> Add Variable -> put Variable Name and Value. Step 3. Add Variable name: ANDROID_HOME and value: as your SDK path.

Where is my SDK location?

by default, the "Android Studio IDE" will be installed in " C:\Program Files\Android\Android Studio ", and the "Android SDK" in " c:\Users\username\AppData\Local\Android\Sdk ".

Where is SDK path in CMD?

Expand Appearance & Behavior —> System Settings —> Android SDK menu item on the left side of the popup window. Then you can find the Android SDK Location directory path on the right side ( in this example, the Android SDK location path is C:\Users\Jerry\AppData\Local\Android\Sdk ), remember it.


1 Answers

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

enter image description here

like image 81
Hoque MD Zahidul Avatar answered Sep 21 '22 02:09

Hoque MD Zahidul