Wireless ADB without root
Losing a USB cable while using Android Debug Bridge for debugging an app or device has two obvious advantages:
- using device micro USB port for other activities like charging via AC adapter (helpful during extreme tests)
- reducing amount of clutter on your desk
So let’s do it. Here is the list of the ingredients:
- device IP address
- few minutes of spare time
1. First, let obtain the IP address from the device
There are two ways of doing it via Settings and ADB.
via Settings method:
Open Settings -> Wi-Fi -> Select network connected to or open Advanced
via ADB method:
Once ensured that USB debugging is on, type the following in command prompt:
$ adb shell netcfg lo UP 127.0.0.1/8 0x00000049 00:00:00:00:00:00 sit0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00 ip6tnl0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00 wlan0 UP 192.168.0.14/24 0x00001043 cc:d2:9b:7b:54:db p2p0 UP 0.0.0.0/0 0x00001003 ce:d2:9b:7b:54:db
wlan0 is the configuration we are looking for and it provides with IP address.
In both cases, you will have your IP address displayed (in our case: 192.168.0.14). Make a note of it as it will be required to make accessing ADB via Wi-Fi possible.
2. Engaging wireless connection:
Execute while the device is connected to PC via USB cable and USB debugging is on.
Switch ADB to TCP mode:
$ adb tcpip 5555
Then connect the device:
$ adb connect <device IP address>
Verify the connection is established:
$ adb devices List of devices attached 192.168.0.14:5555 device
Now you can dump USB cable as its no longer required.
There is one major disadvantage of this solution – after device restart, it will revert back to USB mode, therefore wireless connection has to be established again.
Hope this help with debugging.