1

Scenario

Attemping to run $ react-native run-android results in

Scanning folders for symlinks in /Users/Jackson/Sites/fnmultiapptest/node_modules (11ms) 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/getting-started.html

Relevant Info

I can run my app fine from Android Studio if I run it on an emulator. I can also connect to the react-native "Metro Bundler".

adb devices reports back with emulator device id.

ANDROID_HOME and ANDROID_SDK_PATH are present and correct

Question

Why can't I install my app to the emulator when using react-native run-android if it works fine via Android Studio (which also uses ADB)

Extra Notes

  • Working on a MBP w 12.14 Mojave
  • Android Studio version 3.2.1
  • Emulator OS is 8.0 (api 26)
2
  • Which is your emulator's OS version?
    – Jose Vf
    Commented Oct 18, 2018 at 19:43
  • @JoseVf Using 8.0 (26) - I also added that info to my question
    – Jacksonkr
    Commented Oct 18, 2018 at 21:01

2 Answers 2

14

This seemed like a blanket try/catch error message so I dug in the the command mentioned cd android && ./gradlew installDebug

And when running that I saw gradlew permission denied

So I ran chmod +x ./android/gradlew and violá

2
  • 1
    chmod +x ./android/grandlew is not working, chmod +x ./android/gradlew should work as expected
    – LeonHeart
    Commented Feb 18, 2019 at 4:30
  • I always forgot chmod :(
    – Saeed
    Commented May 28, 2019 at 6:23
0

you might check the permissions on android/gradlew

they should be 755 not 644

run

chmod 755 android/gradlew 

inside your app root folder then open your terminal again and run

react-native run-android

and it should work again.

Not the answer you're looking for? Browse other questions tagged or ask your own question.