shinzou
shinzou

Reputation: 6232

React native project won't run on mac

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?

Upvotes: 1

Views: 5781

Answers (4)

Rahul Ravindran
Rahul Ravindran

Reputation: 482

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

Upvotes: 5

Ankit Aggarwal
Ankit Aggarwal

Reputation: 3131

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.

Upvotes: 2

user3673952
user3673952

Reputation: 987

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.

Upvotes: 2

Andreyco
Andreyco

Reputation: 22872

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.

Upvotes: 0

Related Questions