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

Solution 1:

Running

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

worked for me

Solution 2:

Run the following command

chmod 755 android/gradlew

inside your app root folder then run

react-native run-android

Solution 3:

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

Solution 4:

After you create your react native app ,try

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

-react-native run-android works !