How can I enable live reload in the android emulator?
The documentation for android wasn't very helpful for a android noob.
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.
Executing the command, the configuration menu will appear adb shell input keyevent 82
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é.
- 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.
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.
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.
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
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.
If someone try to Open the In-App Developer Menu in react native
Android -> CTRL + M or you can shake your device as well
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)