As an Android developer, I’m spoiled. I depend on my IDE, logcat, and most of all, the Android Debug Bridge (adb). The adb can be run from a command line or directly in Eclipse. It allows me to load applications and see
real-time console output; most importantly, it gives me the ability to set
break points and single step through my code. The standard regiment is to enable debug on the phone or
tablet, install the necessary drivers on the PC, and connect the device via a
USB cable.

But what happens when you can’t connect the device via a USB
cable? Say, for example, the
application you’re writing uses the USB port to connect to an
external device like a card reader or a game controller. This is the scenario I found
myself in recently.

When I
complained about my predicament to a buddy who also happens to be an Android
developer he asked, “Why don’t you run adb over TCP?” I responded, “You can do that?” The answer it turns out is a resounding yes. In just a few minutes, he had me up and
debugging over my wireless connection. I’ve
outlined the steps below.

  1. Open a command prompt and navigate to the
    directory where your copy of ADB.exe lives.
  2. Type “adb tcpip 5555” and press Enter.
  3. Type “adb connect”, replacing
    the with your phone or tablet’s IP address. Press Enter.

should be able to do anything over the Ethernet that you were doing over a
USB cable before. The only caveat
is at least over wireless adb is a little sluggish. If you’ve ever tried to debug a USB device
though from logs retrieved post mortem, you know a slightly slower adb
connection is a small price to pay.

See an enlarged view of the image.

When you’re ready to switch back over to USB, connect the USB cable to the device first, type “adb USB”, and
press Enter.