React Native "Failed to connect to the development server."

I know this has already been set several times, but no solution worked for me. In fact, sometimes it connects, and my application runs on the device, but one or two attempts later, without any changes, this does not suddenly happen. My application always runs in the emulator.

I set my IP address in AppDelegate.m and RCTWebsocketExecutor.m. I set the security settings at the application level "Allow arbitrary loads" and even set it to allow my IP address. My application uses react-native-storage to store the user, but not sure if this could cause testing problems.

0
source share
2 answers

I understood that. This was a network problem. I used ngrok to solve my problem.

0
source

What worked for me was to launch the developer menu :

adb shell input keyevent 82 

In the Dev Settings > host and port of the debug server for the device, I entered the local IP address of my machine, and then port 8081, that is 192.168.0.1:8081.

To get the local IP address, I used the command ifconfig, and I found the value of the inet field for the Wifi interface, i.e. wlp2s0 .

Hope this helps!

EDIT

, .

0

Source: https://habr.com/ru/post/1622640/


All Articles