- Published on
Android Development: Wi-Fi Debugging
- Authors

- Name
- Daisuke Kobayashi
- https://twitter.com
Starting with Android 3.1, Android devices gained a feature called the USB Host API. It allows the Android device to act as the host, supply power, and control external USB devices.
Recently I was experimenting with this feature to control one of the machines at work, but at first I did not know how to debug that setup.
The basic problem is that Android devices usually have only one Micro USB port. Normally, when debugging on a real device, you connect the PC and the Android device with a USB cable. That already occupies the only port, so you cannot connect the Android device to another USB peripheral at the same time.
To solve this, Android 3.1 introduced Wi-Fi debugging. This lets you connect the PC and the Android device over Wi-Fi and debug without a cable. Use adb, which comes with the Android SDK, and configure it as follows.
As a prerequisite, the PC and the Android device must be on the same Wi-Fi LAN, and adb must already be on your PATH.
Steps
Connect the PC and Android device with a USB cable, then run the following from a terminal.
adb connect 192.168.1.101:5555 (Specify the Android device IP address.)
Disconnect the USB cable and debug from your IDE as usual. In IntelliJ, for example, the device IP address appeared in the device selection list during debugging.
With this configuration, debugging between the PC and Android device no longer requires a cable, which means you can connect the Android device to external hardware and still debug it.
Reference: