1

I have a strange bug with one specific device from work.

I can run my react native app fine on emulators, and on my own device both from terminal and from android studio. But when I try to run the work device form terminal it gives me the following error:

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

Mind you, the device is recognized:

adb devices
List of devices attached
S7M7N15610000083    device

Even stranger still, I can successfully run the work device from android studio! But I want to be able to run it from the terminal using: react-native run-android. Does anyone have any idea what could cause this error?

2 Answers 2

8

Check permissions for android/gradlew file.

Within React native project root folder in terminal

ls -l android/gradlew

If file permission is not like below

-rwxr-xr-x 'links' 'owner' 'group' 'size' 'time' android/gradlew

links, owner, group, size, and time are replaced according to the system.

run

chmod 755 android/gradlew

within ReactNative root terminal.

Source: https://github.com/facebook/react-native/issues/8868

Helpful resource related to permissions:

https://askubuntu.com/questions/528411/how-do-you-view-file-permissions

6
  • Thanks a lot for the response. I have checked what you suggested and it was correct. Just in case I ran chmod 755 android/gradlew, however, this didn't help unfortunately. It is a really confusing error, since android studio is able to run it.
    – Dror Bar
    Commented Jan 28, 2018 at 12:51
  • try "adb kill-server". then "adb start-server" Commented Jan 28, 2018 at 14:05
  • Was worth a shot, but that's a no-go.
    – Dror Bar
    Commented Jan 29, 2018 at 8:41
  • @DrorBar did you find a solutionn? I'm facing the same issue Commented Feb 7, 2018 at 15:40
  • @MartinPalmieri Nope, I'm assuming this is some weird device-specific bug. However, like I mentioned, I can successfully run on the device using Android Studio.
    – Dror Bar
    Commented Feb 8, 2018 at 7:31
0

I also face the same issue.

I solved it by Selecting, * Media device (MTP) once after device connected to the system USB connected. * react-native run-android

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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