App in React On does not update

Asked

Viewed 3,123 times

1

Hello.

I’m doing the app, but the app doesn’t update when I modify the code. It’s only on the default test screen... With the message to press the "R" twice. I’m using the phone to run the application.

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

I believe that the problem may be this, I have already researched, but I have not found a solution.

  • Welcome to Stackoverflow in Portuguese, you might want to make a Tour: https://answall.com/tour or take a look at Help Center: https://answall.com/help and check how to ask questions in a way that is quickly answered, try to inform what you have already tried and post your code, it is difficult for anyone to do the job for you.

  • You could post a screenshot of your mobile phone during this error ?

  • rodouo comando adb -s reverse tcp:8081 tcp:8081 What do you ask for? Did you make a mistake turning it?

1 answer

4

To solve the problem of the red screen when we try to re-load our application we must do the following. We must raise the Node service in a separate port through the command "react-native start --port=8088", but at the time of setting up our mobile have a particularity.

Obs0: Do not close the terminal running your service on the new port, to execute the commands below, open another instance of the terminal. As we have no way to press any key on the phone, we should send the command "adb shell input keyevent 82", this will simulate the 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 the option "Dev Settings" and then click on "Debug server host for device". Now the feature. Run the command "ipconfig" and recover the value of Ipv4, with this value in hand, write the value of your Ipv4:your port (ex: 123.235.0.13:8088). Remembering that the door should be the same as the one initiated by the command "React-Native start". Ready, with this done, your phone will be able to perform the Reload using RR.

If you are using the emulator, just follow the same steps, without using the commands "adb shell input keyevent" and when entering the IP, use the following IP: 10.0.1.1:[chosen port] or 10.0.2.2:[chosen port], which in our case was the port 8088, then I would be: 10.0.1.1:8088 or 10.0.2.2:8088

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

Note: To simulate the RR command just execute the command in the terminal "adb shell input keyevent 46 46".

Note 2.1: If an error occurs, try again, sometimes the connection may be lost.

Note: Official documentation that helped me in the solution: https://facebook.github.io/react-native/releases/0.32/docs/running-on-device-android.html

Obs4: The mobile phone must be connected in the same wi-fi network of the computer.

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

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

I hope I helped. A hug!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.