Quick Tip: Lose the cables, use Wireless ADB!
No Rooting Required.
I have been developing on Android for over 4 years now and only discovered wireless debugging a few months back.
Better late than never though, as this has made developing on Android with physical devices a breeze.
Android emulators have become super fast today, but if you are like me and still prefer using a device in hand this tip will help you untangle your development experience.
To get started however, you need to keep the usb cable handy for the first time setup:
- Make sure USB Debugging is enabled on the test device.
- If you are connecting a device for the first time, then a pop up would appear on the device asking “Allow USB Debugging?”.
- Check the ✅ Always allow and Select OK.
- Ensure that adb is added to the PATH variable on your system.
- Make sure that the Android Device and your computer are on the same Wi-Fi network.
- Get the IP address of the Android test device. (Settings → About Phone → Status → IP Address)
- Now open up the terminal, windows users can open up the command prompt and type in:
adb tcpip 5556
adb connect <Enter Device IP Address here>:5556
You can try other port numbers if 5556 doesn’t work on your system, just make sure that the port numbers on line 1 and 2 are the same.
The output will show that adb is now connected:
connected to <Device IP Address>:5556
You can remove the USB cable and Voila! your test device is now connected to ADB over Wi-Fi.
I work with multiple devices in the office and at home, so I have written simple scripts to help me connect with the devices even faster.
Sample Script: oneplus6home.sh
adb kill-server
adb tcpip 5556
adb connect <Device IP>:5556
I have added the adb kill-server
to make sure you don’t face any weird bugs when re-connecting device.
This works well if your devices are assigned static IP addresses or remain always connected to the Wi-Fi network.
You can easily assign static IPs to your home devices in your router settings, this also helps devices latch on to the network faster.