Search code examples
react-nativeadbwifi

Physical device on wi-fi disconnects from metro and I can't reconnect through wi-fi


I use the VS-Code terminal to open metro using 'npx react-native start' and then connect my device through USB and install the app and run it using 'npx react-native run-android'. I then remove the USB cable because it is disconnecting and connecting constantly so I work through wi-fi, but sometimes the device disconnects from the dev-server and I cannot reconnect without using a USB cable again and repeating the steps above. I have set my ip and port in the dev menu in-app. Any tips would be greatly appreciated!

I have tried using adb reverse or adb connect commands, but to no avail.


Solution

  • When you connect your device by USB follow next commands

    1. adb tcpip 5555
    2. disconnect from usb
    3. adb connect 192.168.1.35:5555 - your device local IP
    4. adb devices check only one device connected by USB exists