Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native run-android deploys old build

Tags:

react-native

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?

like image 482
John Avatar asked Jan 24 '26 02:01

John


1 Answers

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.

like image 155
Bill Avatar answered Jan 27 '26 01:01

Bill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!