App in react native does not update

1

Hello.

I'm making the app, but the application does not update when I modify the code. It only stays on the standard test screen ... With the message of pressing the "R" twice. I'm using the phone to run the application.

During compilation this message appears: Could not run adb reverse: Command failed: adb -s reverse tcp: 8081 tcp: 8081

I think the problem may be this, I've already researched it, but I have not found a solution yet.

    
asked by anonymous 09.08.2017 / 21:10

1 answer

2

To solve the problem of the red screen when trying to reload our application we should do the following. We must upload the node service on a separate port through the command " react-native start --port=8088 ", but at the moment of setting up our mobile we have a particularity.

Obs0: Do not close the terminal that is running your service on the new port , to execute the commands below, open another instance of the terminal. Since we can not press any key on the phone, we should send the command " adb shell input keyevent 82 ", this will simulate Ctrl + M (used to open the menu if you are using the Android Studio emulator) and open the options menu.

With the menu open, choose " Dev Settings " and then click " Debug server host for device ". Now the particularity. Run the " ipconfig " command and retrieve the IPv4 value, with that value in hand, type the value of your IPv4: your port ( ex: 123.235.0.13:8088). Remember that the port must be the same as the one that was started by the " react-native start " command. Soon, with that done, your cell phone will be able to reload using the RR.

If you are using the emulator, just follow the same steps, without using the " adb shell input keyevent " command and at the time of entering the IP, use the following IP: 10.0.1.1: [port_cropped] or 10.0.2.2:[port_cropped], which in our case was port 8088 , then it would look like: 10.0.1.1:8088 or 10.0.2.2 : 8088

Obs1: If it does not work using ip 10.0.1.1 or 10.0.2.2, use IPv4 even in the emulator.

Obs2: To simulate the RR command, simply execute the command " adb shell input keyevent 46 46 " in the terminal.

Obs2.1: If an error occurs, try again, sometimes the connection may be lost.

Obs3: Official documentation that helped me in the solution: link

Obs4: The cell phone must be connected to the same wi-fi network as the computer.

Obs5: This problem occurs with people who already have their port 8081 compromised by some service, and for some specific reason, they can not stop it. (Ex: McAfee )

Note: All commands mentioned above must be executed in the root folder of your project.

I hope I have helped. A hug!

    
11.08.2017 / 05:21