When you are developing for an Android APP with a real hardware device connected, you might face a situation where the device is detected, but looses the connection after a couple of seconds or minutes, but never reproducable.
Your device is still connected as media device (MTP mode) or digital camera (PTP mode) and you are able to transfer data to and from the device.
When your run adb devices on your command line right after connecting the device, you can see it in status “device”. After some time, it is still registered but the status is “offline”.
In your eclipse, when you perform a “Run as -> Android Application”, the device manager shows your device but the target is “unknown”.
On the web, you find many hints like,
- Install the naked device drivers
- Install the Nexus Root Toolkit and the raw drivers (If you got a Nexus device)
- De-Activate and activate USB-Debugging of your device
- Reboot your device
- Update your Android SDK
However, while all of them might be right, at the I found a small hint in a StackOverflow discussion, that it might be an issue of your USB cable.
And there we go: I had a valid development environment working fine for over a month, without any problems with my different nexus devices as well as older test devices. But then I grapped the cable of a new ASUS device of a collegeue and the day was lost.
It might not be a problem of Asus cables in general, and other vendors might produce weak cables as well. But, the first thing you should do when having connection problems during your android development, is to try a different cable before uninstalling and installing drivers and toolkits for a lot of hours.