ADB disconnects frequently while moving in a car I filed this as an Android bug (AOSP Issue #175555) and somebody recommended posting here. I'm actually not sure it's appropriate to post this here but I'll give it a shot.


Get into a car a passenger.
Open your laptop and plug in your phone.
Watch logcat
Ask the driver to make their way to the freeway using a route that take more than 5 minutes.


Roughly, after about 5 minutes the phone will disconnect from ADB. Unplugging the phone and plugging it back in, the phone will reconnect but disconnect. Maybe it's an illusion but it seems the faster the car is driving, the quicker it will disconnect. 

I've tested this with an HTC One M7 and a OnePlus One. If the OnePlus is not involved, the HTC always seems to be able to reconnected. However, once the OnePlus can't connect enough times, nothing can connect, not even the HTC One. The OnePlus seems to "poison the well" as it were.

I've tried several different USB cables and ports on two computers, a Macbook Pro and a Lenovo Yoga. I'll be on a road trip this summer and can debugging more with a third phone.

If there are any tools that I can use or commands I can run to help debug this issue, please advise and I'll use them the next time I'm debugging my app in the car.

Lastly, sometimes my OnePlus disconnects while on my desk but it's far less frequent and usually only after a long period of not being used.
Since you are sure that its not a port/USB wire issue and since ADB does detect phone, its not a driver issue either. Hence saying what the real problem is likely not really possible to be accurately predicted. ADB is a very "delicate" stuff. A slight connection problem causes disconnects... My best bet here would be loose connections. You should certainly try with other computers if you can.

For timebeing, there is one thing you can try if you debug while phone is on (and not in recovery or fastboot mode), ADB through wireless. Like using your wifi for adb. The adb client will be on your laptop and you can issue commands just like normal to phone through your laptop. Although modern ROMs have inbuilt option for this called ADB over wireless which you can find under settings-&gt;developer options. But in case you dont have that option, you can also use third party apps that allow you to do so like ADB Konnect.

Just install and open any such app and it should give you an address according to wifi/network you are connected to. Lets say it gives you 123.456.7.8.

Then open CMD/Terminal in laptop and use the command adb connect 123.456.7.8 to get connected to adb. Then you can issue all your commands as normal.

The downside is that your phone Has to be on. So in recovery/fastboot etc, you cant work using this.