Android

Debug Android applications over Ethernet

William J. Francis recently learned you can run the Android Debug Bridge over TCP. Learn how easy it is to do.

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 1.1.1.1:5555", replacing the 1.1.1.1 with your phone or tablet's IP address. Press Enter.

You 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.

AndroidDebuggingDOS_100813.png
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.

About

William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intellige...

1 comments
puppy249
puppy249

debugging android apps over the ethernet adds so much mor fun to having an adroid phone or tablet.awesome!!!!!