1

I know that it has been asked many times.

I'm trying to debug a rect-native app through wifi because I need to connect an usb device to the phone.

I have followed the instructions in the documentation.

When I try to reload the app, I have the red screen:

could not connect to development server

However, When I put the URL in the browser, it works:

React Native Packager is running

Obviously I' missing something here, but I can't figure out what it is.

Any help appreciated.


EDIT: Saw this answer. It allows me to install the app via Wifi but not to debug it :(, still have the red screen of death.


EDIT 2:

Tried to overcome the problem by fetching the bundle with curl and put it in the asset folder for it to be embedded. This part works but I still can't debug, this time I have more subtle error message:

Unable to connect with the remote debugger

CLEARTEXT communication to 192.168.1.61 not permitted by network security policy.

which leads to this question.

EDIT 3: Solved by modifying the existing react native network config file

enter image description here

  • your phone shouled be connected to the same wifi as your computer – Rebai Ahmed Aug 20 '19 at 09:35
  • @AhmedRebai it is. –  Aug 20 '19 at 09:36
  • check your usb then , your device is connected or not , by running adb list – Rebai Ahmed Aug 20 '19 at 09:37
  • Did you try the command `adb reverse tcp:8081 tcp:8081` ? – Onlinogame Aug 20 '19 at 09:39
  • - Output `$ adb devices`? - Did you set dev-server and port via dev settings? – schogges Aug 20 '19 at 09:50
  • @AhmedRebai The app has been installed via usb, now usb is disconnected. –  Aug 20 '19 at 09:51
  • @Onlinogame Yes I did that too. –  Aug 20 '19 at 09:51
  • @schogges Phone is no more connected via USB once the app has been installed.That is the point. Yes I set ip and port of the host via dev settings as explained in the instructions –  Aug 20 '19 at 09:52
  • Try to restart then your porject – Rebai Ahmed Aug 20 '19 at 09:53
  • Anyways your phone should be listed at `$ adb devices`. Did you do `$ adb tcpip 5555` and `$ adb connect :5555`? – schogges Aug 20 '19 at 09:56
  • @schogges I did just now. adb devices is showing my phone. But the phone still can't connect to the dev server. –  Aug 20 '19 at 10:58
  • Ok maybe it helps if once your phone is connected and visible at `$ adb devices` with it's IP, run `$ react-native run-android` again. If there is still the error, restart bundler, delete the app, `$ react-native run-android` again to reinstall the app and don't forget to set your dev-server's ip and port through dev-settings again (like `192.168.x.x:8081`). – schogges Aug 20 '19 at 11:31
  • @schogges This is crazy, the app is correctly reinstalled on the phone via the network, but I can't still access the dev server when loading the JS bundle. Again launching a browser and using the specified URL works like a charm :( –  Aug 20 '19 at 12:01

0 Answers0