Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to develop Create React Native App without a network - using USB only

I would like to develop an app in Create React Native App in the environment where connecting from the Android device to the development server is not possible.

I have installed Android development tools on my laptop and the device is connected to it via USB. When I run npm run android everything starts correctly as it should, Expo is opened in the device but then it ends with an errors:

Could not load exp://192.168.128.150:19000. Can't connect to internet. Please try again

Does this mean that I cannot use Create React Native app without network between the mobile device and the working computer ?

like image 267
ps-aux Avatar asked Jan 19 '26 19:01

ps-aux


1 Answers

It might not be the best solution, but it worked for me and i hope it'll be enough to help you out!

I was having the same problem and did the following:

  1. Connected the device to the PC through the USB Port
  2. Verified if it was authorized using adb devices
  3. Disconnected the PC/Laptop from the internet
  4. Ran npm run android with the device connected
  5. Waited for the Javascript Bundle to be built
  6. Reconnected the PC to the network after the application was running on the device

After that i could normally develop through the USB! Hope i've been of help!

like image 94
Túlio Oliveira Avatar answered Jan 21 '26 07:01

Túlio Oliveira