adb connect to device over wifi code example
Example 1: adb wifi connect
# Connect device via USB and enable USB-debugging in developer options
adb devices
# to get device id
adb -s <device id> tcpip 5555
# Find out the local IP address of the Android device.
# You can find this information by pressing/long-pressing the WiFi icon in the quick
# settings drop-down and then clicking the WiFi network you are connected to.
adb connect <IP address>:5555
# done!
Example 2: connect adb over wifi
# sleep 5 is to wait for the device to restart listening.
adb kill-server && adb tcpip 5555 && sleep 5 && adb shell ip route | awk '{print $9}' | xargs adb connect