0

So I literally just started my react native app and am trying to run the app on the simulator. I am using Genymotion and am on the Mac. I have upgraded Genymotion to the latest.

Stack:

  1. npm: 6.4.1
  2. react-native: 0.57.1
  3. react-native-cli: 2.0.1

I have done these steps:

  1. adb reverse tcp:8081 tcp:8081
  2. npm start
  3. react-native run-android

I did steps 1-2 in one terminal tab and step 3 in another. I have tried to add port 8081 as a flag on step 3 and that did not work. I also tried to do this:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

and it did not work. Instead I get this as an error:

Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from `/Users/jeffrey/projects/desti/index.js`: Module `@babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map

Update: Ok I resolved it. I added this to my dependecies: "@babel/runtime": "^7.0.0-beta.55". I yarn installed and did steps 1-3 again. However, now I run into the issue of 'could not connect to development server'

Update2: nvm, what I said before resolved it. I don't know what happened with that device I created in Genymotion, but I had to delete it and recreate it and it worked. I noticed this because I had a Pixel simulator on Genymotion and it worked fine, but not this one.

How should I close this?

LemonPie
  • 806
  • 1
  • 11
  • 23

2 Answers2

0

If you cannot load it from localhost, and exhausted all options - try the below:

Option 1 (Change your listening address IP and port)

Get your Mac IP Address:

Use ipconfig getifaddr en1 for wireless, or ipconfig getifaddr en0 for ethernet.

(Kindly taken from: https://apple.stackexchange.com/questions/20547/how-do-i-find-my-ip-address-from-the-command-line)

Open your development console in React Native:

Go to your emulator > CMD + M or adb shell input keyevent 82 - Then in the menu that opens, go to Dev Settings, debug server & host port for device, and edit the IP and port (enter the IP you have from your command prior and the port will likely be 8081) like 1.1.1.1:8081

Go back and reload JS. If the metro bundler has not started, in your cmd type react-native start.

Option 2: From Android Studio

Open your project in Android Studio and Run your project there. Again, if the metro bundler isn't present run the react-native start

JRK
  • 3,686
  • 1
  • 13
  • 19
0

I found out the answer myself. I needed to add the dependency: "@babel/runtime": "^7.0.0-beta.55". I don't know why it solved it, but it did.

LemonPie
  • 806
  • 1
  • 11
  • 23