Reputation: 622
So I'm getting this error
~/projects/personal-projects/react/myapp ⌚ 18:12:24
$ react-native run-android --variant=release
Scanning folders for symlinks in /Users/user/projects/personal-projects/react/myapp/node_modules (22ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installRelease)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring 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.
BUILD FAILED
Total time: 14.706 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
I already have my android sdk installed and I also have java installed.
this is what is in my .bach_profile
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export JAVA_HOME=$Home/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
I've tried adding a local.properties file and added sdk.dir pointing to my Android/sdk folder. But still this error persists. How do I fix this?
Upvotes: 1
Views: 8443
Reputation: 622
So the solution to my problem was:
1) add my ANDROID_HOME and JAVA_HOME paths in my .bash_profile
2) Create local.properties
and add sdk.dir=<PATH TO ANDROID SDK>
inside the android folder.
Upvotes: 0
Reputation: 1226
You need to add ANDROID_HOME, JAVA_HOME variables in environmental variables and tools and platform-tools in path of system to run android apk.
Setting ANDROID_HOME variable in environmental variables.
Setting JAVA_HOME variable in environmental variables.
Upvotes: 1
Reputation: 1547
Please make file local.properties
in folder android
then add the following line on file
sdk.dir=/Users/apple/Library/Android/sdk(Please add your sdk path here)
Upvotes: 1