How to enable live reload in react native on android?
AndroidReact NativeAndroid Problem Overview
How can I enable live reload in the android emulator?
The documentation for android wasn't very helpful for a android noob.
Android Solutions
Solution 1 - Android
-
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.
Solution 2 - Android
Executing the command, the configuration menu will appear adb shell input keyevent 82
Solution 3 - Android
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é.
Solution 4 - Android
- Using shortcuts:
CTRL + M
, orCMD + 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.
Solution 5 - Android
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.
Solution 6 - Android
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.
Solution 7 - Android
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
Solution 8 - Android
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.
Solution 9 - Android
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)