I am trying to execute reverse tcp command on a android device connected remotely(using adb connect
). But I am getting following error while exec
I just came across this, and while none of the answers worked I eventually got it working repeatably. Following these steps should get you wirelessly debugging your React Native app on your real Android device.
I ran adb kill-server && adb start-server
first. I'm not sure if that's strictly necessary.
adb tcpip 5555
adb reverse tcp:8081 tcp:5555
adb connect YOUR.PHONE.IP.ADDRESS:5555
You can find your phone's wifi IP address from Network Settings -> Wifi -> Wifi Preferences -> IP Address.
react-native run android
for most cases.Open the app, and you get an “Unable to load Script” error. Pressing ‘Reload’ gives an error “Could not connect to development server.” Overcome your despair and push onwards.
YOUR.COMPUTER.IP.ADDRESS:8081
At this point, you should see the bundler loading up with the familiar green bar.
From here you should have your normal debugging experience, minus the wire.
I found that if I'm doing a TCP/IP connection, I need to set the reverse command before I connect to the remote device
Example:
adb tcpip 5555
adb reverse tcp:8081 tcp:8081
adb connect 192.168.1.113
If I connect before performing the reverse, I would always get the error about multiple devices/emulators