react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Running react-native with Genymotion

Open oren opened this issue 11 years ago • 26 comments

I am trying to follow the getting started tutorial and use Genymotion. What are the steps I should take after Genymotion is running? I see an 'Add' button that ask me to 'select new virtual device' but I don't have any devices. At the bottom of the form I see 'Sign in to access all available virtual devices'.

Is that what I should do? sign in to Genymotion? Another question - what command should I use to deploy the app into Genymotion? maybe it's the same command that deploy the app to my phone? react-native run-android ?

Maybe a separate documentation page for setting up a project with Genymotion would be helpful for others?

Thanks!

oren avatar Sep 20 '15 02:09 oren

Genymotion Setup :

  1. Create an account on their website
  2. Install Oracle virtual box 3 )Get genymotion app and install
  3. login with user and pass
  4. click on +(Add) , install device
  5. down load virtual device you want , and then start emulator
  6. run react-native run-android , check emulator app should be running there.

above steps worked fine for me on my mac :)

chandu0101 avatar Sep 20 '15 05:09 chandu0101

  1. ⌘+M to reload javascript

han4wluc avatar Sep 20 '15 14:09 han4wluc

  1. ⌘+M to reload javascript

this was not working on my mac ,so i reported them ,they said they're working on it :)

chandu0101 avatar Sep 20 '15 15:09 chandu0101

I am following the steps (I picked Nexus 5 as my virtual device) and the emulator window shows a red screen tells me 'unable to download JS bundle. Did you forget to start the development server or connect your device'. btw, I am getting the same red screen on my phone.

OS: Ubuntu 15.04 node.js: v2.5.0 [email protected] Phone: Android 4.4.4. Moto X. HW version: p30

oren avatar Sep 21 '15 05:09 oren

some times i also get unable to download JS bundle ,but after few tries it just go away . wish i could help more ;)

chandu0101 avatar Sep 21 '15 13:09 chandu0101

@chandu0101 @oren try doing the reverse proxy thing adb reverse tcp:8081 tcp:8081 and hit reloadJS (this has been deterministically making it work). You can setup auto-reload in the settings. I think it's called the "Menu" button on the sidebar inside genymotion.

bsansouci avatar Sep 21 '15 22:09 bsansouci

Android 5.x devices have also been a lot less troublesome so might want to try that if you can.

ide avatar Sep 22 '15 00:09 ide

@chandu0101 @oren following steps worked for me: brew uninstall watchman brew install --HEAD watchman react-native run-android

Also, you could kill process lsof -n -i4TCP:8081 | grep LISTEN and then run react-native run-android

shahbhavir avatar Sep 22 '15 05:09 shahbhavir

Thank you @chandu0101 but i am on ubuntu 15.05 ):

oren avatar Sep 22 '15 05:09 oren

Does the terminal that pops open when you run react-native run-android say anything?

bsansouci avatar Sep 22 '15 06:09 bsansouci

@bsansouci I run adb reverse tcp:8081 tcp:8081 after react-native run-android but it didn't help. I also tried hitting 'RELOAD JS' button that appears at the bottom of the emulator and also the one that shows up after I hit the Menu button but it didn't do anything.

Here is the terminal output of the command react-native run-android:

Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee061Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore061Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco061Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline061Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp061Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0110Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug
Installing APK 'app-debug.apk' on 'Google Nexus 5 - 5.1.0 - API 22 - 1080x1920 - 5.1'
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 38.412 secs

This build could be faster, please consider using the Gradle Daemon: http://gradle.org/docs/2.4/userguide/gradle_daemon.html
Starting the app (adb shell am start -n com.awesomeproject/.MainActivity)...
Starting: Intent { cmp=com.awesomeproject/.MainActivity }

And here is the screenshot of my Nexus 5 emulator: phone

oren avatar Sep 22 '15 07:09 oren

And does it open another shell with the JS server (React Packager) running in it?

bsansouci avatar Sep 22 '15 14:09 bsansouci

@oren try increasing DEFAULT_MAX_CALL_TIME value

projectname/node_modules/react-native/packager/react-packager/src/JSTransformer/index.js line no : 26

const DEFAULT_MAX_CALL_TIME = 6000000;

chandu0101 avatar Sep 23 '15 05:09 chandu0101

@bsansouci I don't see another shell @chandu0101 increasing it didn't help

oren avatar Sep 23 '15 06:09 oren

@oren Huh... That might be the problem? The first thing it should do is open the dev server that looks like this: screen shot 2015-09-23 at 07 01 13

bsansouci avatar Sep 23 '15 14:09 bsansouci

@bsansouci :+1: for auto-reload tip. Also had to turn on WiredSSID inside the GM emulator to talk to http.

kkganesan avatar Oct 11 '15 19:10 kkganesan

@han4wluc :+1: for

  1. ⌘+M to reload javascript

On Ubuntu is ctrl + M

WaKeMaTTa avatar Nov 20 '15 11:11 WaKeMaTTa

I'm also facing this issue :(

JohnDotOwl avatar Dec 09 '15 08:12 JohnDotOwl

Check list: -device's(such as emulator or smart phone) wifi connection -react-native server status

newyu avatar Dec 16 '15 15:12 newyu

@oren try following:

$ git clone https://github.com/facebook/watchman.git $ cd watchman $ ./autogen.sh $ ./configure $ make $ sudo make install

then

react-native start

then try

react-native run-android

The problem is they didn't mention that how can we install watchman(on linux) on the android development setup docs as react-native development server requires watchman to be installed.

note: run the react-native start and react-native run-android from two separate terminal instance.

flexzero avatar Dec 28 '15 15:12 flexzero