Environment
Windows 10
Npm 5.5.1
react-native-cli 2.0.1
react-native 0.50.3
Genymotion Google Nexus 7 - 6.0.0 API 23
Just changing port doesnt solve the issue, instead it creates more unless you also change the port from the device itself.
First, confirm if its the case:
$> netstat -aon|findstr “8081”
Now change it to run from a new Default Port
a) Change env variable on windows to set a new port for RN:
$> SET RCT_METRO_PORT=8083
This is used in RN to use as the default port, and if not set it defaults to 8081
b) Remove old reverse:
$> adb reverse –remove-all
c) Set new reverse port for the adb device:
$> adb reverse tcp:8083 tcp:8083
d) Change Dev Settings on the device from the default 8081 to 8083.
Run the app and then run input keyevent 82, now select Dev Settings > Debug Server host … > enter new url: localhost:8083
build and run again