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.
- Connect your phone and computer to the same network
- Connect your phone to your computer via USB
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.
- Disconnect the USB wire.
- If the app isn't yet installed, install the app on your phone the way you usually do over USB,
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.
- Open the developer menu (shake the phone with your React Native app open) and select “Dev Settings”. Select “Debug server host & port for device” from the menu.
Find your computer’s ip address. Enter that in the window on your phone, followed by the port number 8081:
YOUR.COMPUTER.IP.ADDRESS:8081
- Now shake and reload. Sometimes this doesn’t do anything, so closing the app and reopening does the trick.
At this point, you should see the bundler loading up with the familiar green bar.
- shake and hit “debug js remotely”.
From here you should have your normal debugging experience, minus the wire.
adb forward
is working, butadb reverse
is not! Did you solve it? – Wheelbase