Create a new file named adbtowifi.sh
#!/bin/bash #Modify this with your IP rangemy_ip_range= "192\.168\.43" #You usually Wouldn ' t has to modify thisport_base=5555#list the devices on the screens for your viewing pleasureadb devicesecho#find US B devices only (no emulators, genymotion or connected devicesdeclare-a devicearray= (' adb devices-l | grep-v Emulator | Grep-v VBox | Grep-v "${my_ip_range}" | grep "Device" | awk ' {print '} ') echo "found ${#deviceArray [@]} device (s)" Echofor index in ${!devicearray[*]}doecho "Finding IP Address For device ${devicearray[index]} "ip_address=$ (Adb-s ${devicearray[index]} shell ifconfig wlan0 | awk ' {print $} ') echo" IP address found: $IP _address "echo" Connecting ... "Adb-s ${devicearray[index]} TCPIP $ (($PORT _base + $index)) Adb-s ${de Vicearray[index] "Connect" $IP _address:$ (($PORT _base + $index)) "Echoechodoneadb Devices-l#exit
The above script files, Mac or Linux directly can run, Windows need to install some such as msysgit or Cygwin to run above Linux shell//premise need USB connection adb, after playing command, you can unplug the USB cable, When the phone is switched to the WiFi connection, after connecting to the WiFi, such as switching back to USB, using ADB USB or restarting the device can be SH adbtowifi.sh