Can only update react native on emulator, not physical device

Wesley

New Member
#1
I have an app working on a local emulator that is updating live and doing all the things it should be doing.

I also have a physical device connected via USB, and deploying to the device through 'run-android' works successfully, so the bridge is working.

However, the app only shows the default react native welcome screen. Any attempt to update the app results in "Could not connect to development server".

I have tried the suggestions on the screen and they aren't helping. Where do I go next?
 

Admin

Administrator
Thành viên BQT
#2
You probably actually can't talk to the dev server. On an emulator a virtual network with the host PC is automatic, on a real there's no virtual network set up between it and the device. You need to actually have an open port on your desktop for it, and hit the right IP on your physical device, with the wifi network (I'm assuming they're on the same wifi network) set to allow requests to your PC.

Or turn dev support off and include the bundle file in your app. Then you're not going to hotload code, but you have a static version ready to go without a server to talk to.
 
OP
OP
W

Wesley

New Member
#3
Interesting. So even though it can deploy to the device, that's only a file system transfer and doesn't indicate any other connectivity? Huh. How do I turn off dev support and include the bundle?

How would you suggest I identify steps to diagnose and correct the network issue over time?
 

Admin

Administrator
Thành viên BQT
#4
Deploy to the device is pushing the entire apk file (android app). Loading the bundle in dev support mode requires it to talk to a dev server. In your ReactNativeHost, override getUseDeveloperSupport to false to turn off dev support. If you use all the RN tools, there should be a bundle file in your assets directory. If its named index.android.bundle it should be read automatically, assuming you didn't override anything else.
 
Top