I am running the react-native run-android
command with a physical Android device connected to my computer via a USB port. However, when I disconnect the cable, I cannot reconnect back to the Metro server automatically. I have to rerun the command, wasting time. Is there any command I can use to reconnect?
To automatically reconnect to the Metro server without having to rerun the react-native run-android
command, you can use the following command:
adb reverse tcp:8081 tcp:8081
This command sets up a reverse proxy between the device and your computer, allowing the device to connect to the Metro server running on your computer.