Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ADB-over-WiFi still disconnects when USB cable is cycled (?!?)

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!

like image 503
AndroidNewbie Avatar asked Dec 18 '13 20:12

AndroidNewbie


People also ask

Does ADB work over Wi-Fi?

To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options. To use adb with a device connected over Wi-Fi, see Connect to a device over Wi-Fi. On Android 4.2 and higher, the Developer options screen is hidden by default.

Is wireless ADB safe?

Since Android 4.2. 2, connections to ADB are authenticated with an RSA keypair. This prevents unauthorized use of ADB where the attacker has physical access to a device. Unless the attacker steals the keypair their only option is to trick you into authorizing a new device which really isn't anything new or novel.


1 Answers

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.

like image 88
mparkes Avatar answered Sep 20 '22 16:09

mparkes