1

I'm trying to run react native on mac, I run the android emulator in the background and run react-native run-android and I get:

=> react-native run-android
Scanning 564 folders for symlinks in /Users/sao/Conv/Conv2/node_modules (19ms)
Starting JS server...
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

The react awesome project (react-native init) works fine on this machine and this project run fine on windows.

It says check error above for details but there's no error above...

Any ideas on how to make it work?

16
  • If you are still stuck on it please check my answer and let me know if that solves the issue. Commented Jun 2, 2017 at 10:32
  • Did you install JDK to your MAC? Commented Jun 4, 2017 at 7:02
  • Yes the react awesome project works. @EnieJakiro Commented Jun 4, 2017 at 7:50
  • OK, probably installation went wrong. Try react native init from scratch after rebooting your system Commented Jun 4, 2017 at 8:12
  • You mean to add my project to the react awesome project? @EnieJakiro Commented Jun 4, 2017 at 8:50

4 Answers 4

5
+50

try running adb devices in terminal, if its blank run adb kill-server then follow it up with adb start-server

Sign up to request clarification or add additional context in comments.

4 Comments

Try running 'chmod 755 android/gradlew' inside your app root folder, then run 'react-native run-android' this could be because of gradle permissions source: github.com/facebook/react-native/issues/…
This helped, it now installs the app but I'm getting errors in native components: pastebin.com/DibRnaun, how did you think about permissions?
@RahulRavindran nice solution. Put it in your answer. kuhaku the error you are getting generally occurs when you write some javascript logic inside your JSX component and that javascript logic does not return any component to render. So move that code outside the JSX component. But as you said it runs perfectly on windows, so can't say if this can be the issue or not because there is no code attached related to it. E.g. <View> x = y </View> can cause this issue.
in windows how can run this chmod 755 android/gradlew commend
2

Had the same problem, ended up recreating the project on a mac and added the files from the old project;

My project uses git, so I can tell you that the only files that did change while I recreated the project are:

  • android/gradlew
  • android/gradlew.bat

I guess you could create a new project and copy-paste those files, but I'm not sure that it would work, as I did not try it.

4 Comments

How did you recreate the project?
also can you please check what lines were different? Maybe it's just one line in both...
I compared those two files in my project vs the react awesome project (which does work) and they're identical...
I had the same problem. copied just the two files and it fixed the issue
2

As you said emulator is already running so the other problem can be (according to the error message) that your SDK path is not set in your android project. I got the similar issue and did the following:

  1. open your android folder inside your project folder.
  2. create a file local.properties and copy paste the following in that file: sdk.dir=YOUR_ANDROID_SDK_PATH.

E.g. in my system SDK path is sdk.dir: /Users/USER_NAME/Library/Android/sdk.

7 Comments

@kuhaku please tell me one more thing (may not be directly related), is your "adb" command added in $PATH variable? I mean when you type adb does it execute from anywhere. It is because when we do run-android, it checks for devices using adb command and then installs the app. If that command is not there in your PATH, then it might fail. In my system adb is present at the following path: /Users/USER_NAME/Library/Android/sdk/platform-tools/adb. This seems to be the only possibility
Yes adb is in the path.
@kuhaku can you please add more logs because the logs you have posted is saying that "read above for more details". That might help in finding exact reason.There should be some failure reason in the logs message under "what went wrong"
when you run "react-native run-android" you will get logs. It should be just above of whatever you have posted in your question..
I posted everything I'm getting after react-native run-android.
|
0

As stated in the log, you HAVE TO be running simulator or connect real device to Mac

To setup simulator, use Android Studio. Connecting device is much easier and faster, assuming you have one available.

2 Comments

cmd> android avd
I said the emulator was running and the React awsome project did run on the emulator. It says check error above for details but there's no error above...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.