3

I'm building a react-native android app. I am using Windows as my development area. To push my app to my phone, I simply connect the phone via USB to my computer and then I run the command react-native run-android.

This works fine and exactly as expected on one of my android phones.

I have a second older android phone, but every time I run react-native run-android, it receives an old and out-dated version of the app from 2-3 days ago, when I last connected the phone to my computer. I tried to manually uninstall the app from my phone, I tried restarting my phone, I tried taking out the battery, but every time I deploy, it still receives the old version.

How do I get my second android phone to receive the latest version?

John
  • 32,403
  • 80
  • 251
  • 422

1 Answers1

2

If you look at their documentation, Reload JS only works on Android 5 and above with USB debugging. You may want to try method 2 for older devices:

Method 2: Connect via Wi-Fi

You can also connect to the development server over Wi-Fi. You'll first need to install the app on your device using a USB cable, but once that has been done you can debug wirelessly by following these instructions. You'll need your development machine's current IP address before proceeding.

Open a terminal and type /sbin/ifconfig to find your machine's IP address.

Make sure your laptop and your phone are on the same Wi-Fi network. Open your React Native app on your device. You'll see a red screen with an error. This is OK. The following steps will fix that. Open the in-app Developer menu. Go to Dev Settings → Debug server host for device. Type in your machine's IP address and the port of the local dev server (e.g. 10.0.1.1:8081). Go back to the Developer menu and select Reload JS.

You can now enable Live reloading from the Developer menu. Your app will reload whenever your JavaScript code has changed.

Bill
  • 4,506
  • 2
  • 18
  • 29
  • instead of this, do you know also if there's an apk file in my development machine that I can just email over to my phone? – John Oct 08 '17 at 15:57
  • yeah I think you can build a debug build with the JS bundled in so you don't need a development server. I'll see if I can find the documentation for that – Bill Oct 08 '17 at 23:47