Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native run-android command failed, but gradlew installDebug work

I'm using react-native 0.43.3 on OSX. I tried to running app on Android and get message

react-native run-android

Scanning 568 folders for symlinks in /Users/ruci.k/project/mayacrew/supermembers/supermembers/node_modules (5ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
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/android-setup.html

./gradlew installDebug gave me some errors and fixed it all. Finally build get successed and app is working on Android device.

But react-native run-android command still not work. Only ./gradlew installDebug command work.

Is there anything can I check to use react-native run-android command?

I can't understand how could it happened.

like image 507
haru Avatar asked Apr 27 '17 20:04

haru


5 Answers

Running

export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"

worked for me

like image 139
Luis Felipe Zamora Avatar answered Nov 18 '22 03:11

Luis Felipe Zamora


Run the following command

chmod 755 android/gradlew

inside your app root folder then run

react-native run-android

like image 28
Zumry Mohamed Avatar answered Nov 18 '22 03:11

Zumry Mohamed


After you create your react native app ,try

sudo chmod -R 777 node-modules
sudo chmod -R 777 android 
export ANDROID_HOME=~/Library/Android/sdk

now run

react-native run-android 
like image 19
Guru Avatar answered Nov 18 '22 03:11

Guru


Try removing android,ios folders and then do react-native upgrade then try again react-native run-android After that if you get an error like

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

then create a file named local.properties inside the folder

android

and insert the following line sdk.dir =/path/to/Android/Sdk After this everything should be fine

Note: If you have made some changes in android/ios folder please keep its backup before removing the folders

like image 16
Jose Kj Avatar answered Nov 18 '22 04:11

Jose Kj


cd android && sudo ./gradlew clean

This worked for me. Try it out and let me know if it helps folks

like image 10
Paschalidis Christos Avatar answered Nov 18 '22 04:11

Paschalidis Christos