122

How can I enable live reload in the android emulator?

The documentation for android wasn't very helpful for a android noob.

itzmebibin
  • 8,738
  • 7
  • 46
  • 59
Kenneth Lynne
  • 15,147
  • 12
  • 60
  • 76

9 Answers9

268
  • Type the following in your command prompt to install and launch your app on the device or emulator:

    $ react-native run-android

  • Then click on emulator and press CTRL + M (CMD + M on MacOS) or shake the Android device which has the running app.

  • Then select the Enable Live Reload option from the popup.

    enter image description here

Tunvir Rahman Tusher
  • 6,022
  • 2
  • 34
  • 30
itzmebibin
  • 8,738
  • 7
  • 46
  • 59
  • 24
    doesn't work on mac with cmd + m, i have to run `adb shell input keyevent 82` – TomSawyer Aug 22 '17 at 10:28
  • 1
    I hope it helps. You should click on window bar to use Ctrl+M / Cmd+M – bao vu dao Sep 02 '17 at 12:36
  • 4
    ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', android: 'Double tap R on your keyboard to reload,\n' + 'Shake or press menu button for dev menu', – Ashish Yadav Jan 11 '18 at 07:09
  • 1
    Note that if you are going to use keyboard shortcuts in android emulator then you have to set this option: Settings->Send keyboard shortcuts to : 'Virtual device' as I do that and it worked for me. – Newbi Jul 18 '18 at 09:45
  • Confirm it works on Mac os 10.13.6, Android Studio Sep 2018. – CodeGroover Sep 19 '18 at 15:47
  • Hm.. it doesn't log to terminal anything.... app just reloads on save.. – Fikret Sep 02 '19 at 14:36
51

Executing the command, the configuration menu will appear adb shell input keyevent 82

Documentation

zishe
  • 10,375
  • 12
  • 64
  • 102
Jhony Taveira
  • 630
  • 5
  • 6
19

I was BLIND. It clearly states:

On Android shake the device or press hardware menu button (available on older devices and in most of the emulators, e.g. in genymotion you can press ⌘ + m or F2 to simulate hardware menu button click). You can also install Frappé, a tool for OS X, which allows you to emulate shaking of devices remotely. You can use ⌘ + Shift + R as a shortcut to trigger a shake from Frappé.

Kenneth Lynne
  • 15,147
  • 12
  • 60
  • 76
7
  • Using shortcuts: CTRL + M, or CMD + M (macOS)
  • From terminal: adbshell input keyevent 82

Important Note: Using Expo, make sure you are in development mode. The shortcuts will not work in production mode for Android emulator.

I did enable that through Expo XDE by tapping the cog next to the url and checking development mode. You may need to rebuild.

Expo - Development Mode


enter image description here

Vahid Hallaji
  • 6,676
  • 4
  • 42
  • 49
6

I am using Redmi note 3 for debugging purpose and was facing similar issue. The solution was that MIUI by default disables popup permission for apps, which is needed in this case to get the reload screen. After enabling the popup permission for my app it works perfect. Hope it helps someone.

Ishwar Rimal
  • 971
  • 10
  • 18
5

For enabling Hot reloading or Live reloading on Device (external Android phone):

First, run the app using react-native run-android on Terminal.

Now, shake the Android device which has the running app.

Then select the Enable Hot Reloading or Enable Live Reload option from the popup.

nima
  • 6,005
  • 8
  • 32
  • 48
4

To enable live reload in React Native using Android you need to do the following steps:

  • Open you emulator;
  • Execute your application (react-native run-android);
  • Make sure that you application is running;
  • Click on emulator and press: CTRL + M.

Some options will be opened, and you select the "Enable Live Reload" as the image below. Click to see the image

Rodrigo Xavier
  • 212
  • 2
  • 5
2

I found out that, If I execute react-native run-android from the console, then changing and saving file (with any editor) don't reload the app.

But When I execute the app from VS code console, the live reload was working for every change and save.

I think you might need a IDE (such as VS code) for live reloading.

Shamsul Arefin Sajib
  • 1,665
  • 19
  • 19
  • 1
    You can actually enable it by pressing menu key or CTRL+m and selection "Enable live reload" – Asce4s Mar 29 '19 at 06:39
0

If someone try to Open the In-App Developer Menu in react native

Android -> CTRL + M or you can shake your device as well

and

IOS -> ⌘ + m (CMD + M) or shake device

if for some reason IOS Simulator was not working with some reason try to open

simulator -> Hardware -> Shake Gesture ( For me ^⌘Z)

Wasi Sadman
  • 1,272
  • 1
  • 14
  • 23