1

When I execute react-native run-android in the terminal, I get the following:

JS server already running. Running adb -s HT68X0201778 reverse tcp:8081 tcp:8081

Building and installing the app on the device (cd android && ./gradlew installDebug)... Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence. java.lang.RuntimeException: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

FAILURE: Build failed with an exception.

Where: Build file '........./android/app/build.gradle' line: 110

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.

Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I have already done the following: Installed the Android Studio 2.2.3. I checked the boxes in the installer that it said to on the RN website. I installed Marshmallow SDK, AVD, HAXM, and JDK 1.8. I added ANDROID_HOME to /.bashrc and even executed set ANDROID_HOME=~/Library/Android/sdk on the terminal. (I double-checked the path.) I am running on react-native-cli version 2.0.1. Operating system is Mac OS Sierra.

I'm not sure where to go from here. Any help would be appreciated.

Thanks! --Anthony

0

2 Answers 2

4

Create a file called local.properties and add it to the android folder and then define sdk.dir(The location of your android SDK directory) in my case it is: NOTE: you do not need to include it in quotes.

sdk.dir = /home/kbuhiire/Android/Sdk 
Sign up to request clarification or add additional context in comments.

Comments

2

I changed the ANDROID_HOME path from ~/Library/Android/sdk to /Users/myusername/Library/Android/sdk. That did the trick. Refer to React Native android build failed. SDK location not found

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.