7
votes

I am working on a USB-based project so I'm using ADB over WiFi TCP/IP. Works perfectly, and frankly this ability to debug over a wireless connection is one of the coolest development tricks I've used in years. Really, really cool.

I'm working on the various Intents associated with USB connects and disconnects. I've found that anytime the USB cable's physical status changes - whether it's plugged in or unplugged - the ADB wireless connection is lost. I can reestablish it and resume debugging via DDMS, but by then a whole lot of CPU time has gone by. This makes debugging USB connection events basically impossible.

I cannot understand why ADB would still take action on USB events when it is connected via TCP/IP (over WiFi, no less). Is there an ADB configuration detail I'm missing? How do you tell ADB to ignore USB since it's not running over USB anyway?

Thanks!

1
There is no sane reason why adb should be killed if you change something about the USB configuration. So I guess you probably can't change it because it's not intentional. There could be a hardcoded "kill adb" within the usb handling code (because that's usually the right thing to do) or there could even be hardware limitation, e.g. WiFi could be an internal USB device and any changes to USB at all cause some sort of event within WiFi that leads to the death of adb. Reasons are manifold, your options to prevent that unfortunately not.zapl
Agreed this sounds buggy. When you say you can resume debugging, you mean you can issue an adb reconnect via WiFi, or do you have to use ADB-over-USB to re-enable ADB-over-wifi?Chris Stratton
By "resume debugging", I mean that I can 1) adb connect 192.168.x.y, 2) switch to the DDMS view in Eclipse and highlight the process on the device, and 3) click the little "bug" symbol to reassociate the debugger with the process. All of this happens over WiFi. In other words, the process has been running the whole time and I can reassociate and keep debugging it. I just lose the ADB association when I attach or detach the cable, which makes it darned difficult to set breakpoints and debug code that is associated with USB attaches and detaches! {grrrrr}AndroidNewbie
I'm observing the same thing, first time i've got into Android and I see this dodgy behaviour! Maybe it varies by Android version.RichColours

1 Answers

3
votes

I had the same issue and i think managed to solve it by "Revoke USB debugging authorizations"

I then connected over usb and allowed my PC

Then restarted adb in tcpip mode and connected to my device.

It stayed connected when I disconnected the USB cable.

Hope this helps.