From my original discussion on BlueSky here:
In React Native, physical iOS devices can connect to Metro automatically because react-native-xcode.sh writes a file into $DEST/ip.txt for reading at runtime.
On Android physical devices, however, we have to do
adb -s <device_name> reverse tcp:8081 tcp:8081
.Can't Android use the iOS approach?
Nicola Corti recommended hooking into configureDevPorts() in the react-native-gradle-plugin
.
I searched for usages of react_native_dev_server_port
and found getServerIpAddress() in the React Native Android runtime as well.