53

I am using default Android emulator for running react native apps, I need to reload the app frequently, how do I do that?

And how can I set genymotion to set as default emulator for app running?

Box Box Box Box
  • 5,094
  • 10
  • 49
  • 67
rajat44
  • 4,941
  • 6
  • 29
  • 37
  • if you're using macos BigSur then you might want to look at this too . https://developer.android.com/studio/known-issues – imran haider Feb 09 '21 at 17:46

8 Answers8

121

For android one can use CTRL + R
For apple one can use R + R (two times R).

For developers options:
One can also use the Command⌘ + D keyboard shortcut when your app is running in the iPhone Simulator, or Command⌘ + M when running in an Android emulator.

Aleks Andreev
  • 7,016
  • 8
  • 29
  • 37
rajat44
  • 4,941
  • 6
  • 29
  • 37
  • 4
    Is there a reason why me double-tapping "R" on my keyboard wouldn't work? I got a Mac running the simulator perfectly fine. I know it sees my keystrokes because I can initiate multi-tap via cmd. It's just weird that I can't seem to trigger a refresh. – Smokin Joe Mar 15 '17 at 23:03
  • 1
    @SmokinJoe me too. I must use Command+M like rajat44 suggests and choose Enable Live Reload. – Robin Huy Mar 24 '17 at 09:31
  • 8
    @SmokinJoe, make sure in your Android Studio, Tools->Android->AVD Manager->Virtual Device Configuration->Enable keyboard input checkbox is checked. Then try run emulator again, then have a try. and I found I have to double tap R very quickly, otherwise it won't work. – pigfly May 05 '17 at 00:18
  • Сonversely `CTRL +R` for android. https://facebook.github.io/react-native/docs/debugging.html#reloading-javascript – Stanislav Mayorov Jul 12 '18 at 15:49
  • 5
    For me on macOS on an Android emulator, `CTRL + R` does **not** work, only `R + R` does. – Leo Sep 26 '19 at 15:44
  • I'm having problem pressing Cmd+M does nothing, also double tap R does nothing, but they're working on my other project in the same local machine. What is possibly wrong with it? – Jeaf Gilbert Oct 20 '20 at 09:20
51

I tried in this way:

  1. Open Android Studio, then Click Tools->Android->AVD Manager, as shown:enter image description here

  2. Choose your virtual devices, then click edit this AVD,enter image description here

  3. In Virtual Device Configuration, click Show Advanced Settings, scroll down to find Keyboard, then check Enable keyboard input checkbox, then click Finish button.enter image description here enter image description here

  4. Launch this AVD in emulator.enter image description here

  5. In Terminal, in your react native project directory, run "react-native run-android".

  6. Your will see your app will be running in your emulator, if you want to reload the project, you could double tap R(you should type it very quickly, otherwise it may not reload js) or you can type command+M, then you choose Reload. enter image description here Hope this will help. Cheers
pigfly
  • 3,348
  • 2
  • 13
  • 11
45

R+R works for android emulators.

Ajnas Kt
  • 461
  • 4
  • 4
21

to open dev menu with command line: adb shell input keyevent 82

you can activate live reload there.

I would suggest reading the doc if it wasn't already been done

  • The usb port on my device is really sloppy, so I can't shake it (which breaks the packager and ruins everything). I created an alias in /home//.bashrc: `alias adbmenu='adb shell input keyevent 82'`. It has so far proved reliable. Otherwise I cannot enable hot reloading. – agm1984 Aug 13 '18 at 00:58
  • Thanks @Mohamed Mellouki. Your solution is working for me. – abu abu Oct 13 '18 at 15:28
12

Press Ctrl + m, a menu will pop.

for further ease. Enable Hot Reloading: whenever you make changes in your code it will reload itself; You won't have to reload again and again.

enter image description here

Farhan
  • 1,445
  • 16
  • 24
7

For Android emulator press "CTRL + M" with keyboard on emulator for reloading the react native project.

vinay
  • 81
  • 1
  • 6
1

On my mac the dev menu is shown using the "fn" key + M

Simon Borkin
  • 101
  • 2
  • 7
0

If you are emulating on windows using npm, open your command line running the process and press r.