Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 
like image 225
Pyae Sone Nyein Avatar asked Sep 17 '15 15:09

Pyae Sone Nyein


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.

Could not find SDK react native?

By going to File > Settings > Appearance & Behavior > System Settings > Android SDK, you can find the SDK location setting at the top with the option to change, and the default folder being ~/Android/Sdk.

Where is my Android SDK installed?

On a machine with Android Studio installed, click Tools > Android > SDK Manager. At the top of the window, note the Android SDK Location.

Where is SDK located?

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 ".


2 Answers

  • 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

like image 184
Ravin Avatar answered Sep 23 '22 06:09

Ravin


  1. Go to your React-native Project -> Android
  2. Create a file local.properties
  3. Open the file
  4. 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

Replace USERNAME with your user name

Now, Run the react-native run-android in your terminal.

like image 35
Naveen T P Avatar answered Sep 19 '22 06:09

Naveen T P