29

While debugging, my device frequently disconnects from my PC, usually after every debug session. The device still appears in the DDMS list but the status is "offline". The only way to fix it is to reconnect the USB cord, which becomes a pain after doing it 10 times every hour. There are no visible error messages when it happens.

I thought it was a physical connectivity problem with my USB cord or my device, but I recently upgraded to a brand-new Galaxy Nexus with a brand-new USB cord and it still happens. Now I'm convinced it's a software issue.

Is there any reason why my devices goes offline frequently? Are there any programs that are known to interfere with the Android/ADB connection?

serv-inc
  • 35,772
  • 9
  • 166
  • 188
Barry Fruitman
  • 12,316
  • 13
  • 72
  • 135
  • Are you using a usb hub? Or plugging directly into the computer? In either case. If the former, try plugging directly into computer. In the latter, try a different port. It may or may not help, but it's worth a try. – JesusFreke Apr 27 '12 at 17:46
  • I have this issue as well however it is usually after about 1-3 hours of development and I just have to reset ADB and sometimes even disable/enable debugging on my device(s) to get them to respond again. Its an annoyance but nothing to write home about. It seems, on the limited roms that support it, ADB over wifi works reasonably well for me. I have not had the disconnect issues I experienced using ADB over USB. – ian.shaun.thomas Apr 27 '12 at 18:04
  • 1
    Thanks for your replies. I've tried every USB port on my computer. I wouldn't mind so much if it happened every 1-3 hours like tencent but it happens every 5 minutes for me. :( I will try ADB over wifi. – Barry Fruitman Apr 27 '12 at 18:46
  • It was a hardware problem after all, even though I used a new device and USB cable. Sadly, the best solution was to pinch the USB connector with pliers and now it stays securely in the phone's port. Eclipse/adb haven't disconnected once since. – Barry Fruitman May 02 '12 at 17:34
  • 1
    Check this solution out ... http://stackoverflow.com/a/9671157/563306 – dcanh121 Apr 27 '12 at 19:59
  • Same here.. wasted entire day figuring out why is there a frequent disconnections since today morning - finally figured out that the USB cable with which I was working till yesterday was changed. Switched back to old cable and it works like a charm. – KurtCobain Jun 13 '14 at 20:09

11 Answers11

21

Yup, you are right. It seems to be a software issue.I have faced this annoying thing many times, it happens now and then. I think what happens is that the adb's connection with the device/emulator breaks or becomes faulty, so android starts showing the device as offline.

To correct this problem. Go to DDMS-->Devices Tab-->Click the option "Reset adb" (which is the last option, on clicking the dropdown arrow) . You will then see some error report in the console, but after a minute your emulator would be ready to be used without problems. I do it all the time and it works. Try this instead of manually plugging/unplugging the device.

Akhil
  • 13,888
  • 7
  • 35
  • 39
  • 1
    this is a gui alternative to kill-server and start-server. This is what it does in the background. – Akhil Apr 27 '12 at 17:50
  • I was hoping for a solution that prevents the problem but I guess it's happening to everyone so I'll try your advice instead of unplugging the device. – Barry Fruitman Apr 27 '12 at 18:47
  • 1
    Sorry but it doesn't work for me. I just get this DDMS error: Adb connection Error:An existing connection was forcibly closed by the remote host – Barry Fruitman Apr 27 '12 at 19:19
  • 1
    In Android Studio you can use **"Tools -> Android -> Enable ADB Integration"**, just unselect and reselect it. – Rahul Thakur Aug 10 '15 at 10:30
  • Thx @RahulThakur , you saved my day (and my week !) – Arnaud Feb 02 '16 at 18:14
6

Please check this answer https://stackoverflow.com/a/26425489/1200583 that is for mac but maybe is the same for other OSs

enter image description here

Community
  • 1
  • 1
elin3t
  • 1,881
  • 1
  • 24
  • 29
  • I am also using Yosemite and Eclipse Luna and this answer cured my chronic headache.... feeling awkward as the cure was so simple.... thanx a lot @elin3t... – iphondroid Feb 27 '15 at 09:28
5

I find it faster to just plug/unplug, but doing the following in command-line should do the same thing:

adb kill-server
adb start-server
josephus
  • 8,284
  • 1
  • 37
  • 57
0

We feel your pain. In case you're using the command-line, you can do the same thing by typing "adb kill-server".

Yusuf X
  • 14,513
  • 5
  • 35
  • 47
0

I was able to fix this problem for good by updating Samsung Kies, which installed an updated driver for my phone. I suggest you try reinstalling any device drivers.

tayler
  • 536
  • 4
  • 5
0

Patiently, try fixing the USB cord by massaging it and reconnect it to the USB hub securly but not to tight. Also, do not connect with too many USB extended cables or hub or the connection between the device and Eclipse IDE will interfere the duration.

And one thing, do tried putting your device and the USB cord to any flat surface (e.g. table) to support the long cable?

David Dimalanta
  • 548
  • 6
  • 19
  • 4
    The problem is fixed now, and it was a hardware issue all along. I didn't think so before because it happened with more than 4 different cords, but I finally bought a brand-new quality Belkin cord and it has worked perfectly ever since. Frankly, I believe USB cords should work without massaging! – Barry Fruitman Jan 25 '13 at 21:06
  • @BarryFruitman: I can confirm that I had also an issue with brand new cord attached to Galaxy S3... used Nokia cable attached to e51 ... works perfectly... none issues. Checked LG attached to L7 same, no problems. Samsung does great quality phones but forgot about attached to mobile cord quality I think... – Piotr Mąsior Jun 11 '13 at 19:32
  • When the last time I program, honestly, I used to test it by using a device to preview a program. I used a single USB extention cable and connect to the Nexus 7 tablet. I discovered that problem when I inserted another USB HUB extention which contains three slots and I'm gonna used it for my flash drive to store it, one for charging my cellphone, and another one for my device. When I tried using @Akhil's suggestion, it didn't work for me. I decided to remove one USB extention that contain three slots and only left with the long one slot ones, it works. – David Dimalanta Jun 12 '13 at 10:39
0

I had the same problem with Galaxy Nexus running CM 10.1.

Updating KIES with latest version seems to have fixed the issue.

Umair A. Shahid
  • 134
  • 1
  • 4
0

Connect your device through a powered USB hub. Some machines, including new apple macbooks, do not have enough power in the USB ports causing ADB to constantly disconnect.

If your device is rooted, you can connect it to adb via wifi. This is very comfortable, much more than wired USB. Of course you don't always have a rooted device.

grebulon
  • 7,697
  • 5
  • 42
  • 66
0

I also faced this issue. Adb disconnect my Android device each time just after installing the app in android device from eclipse. The issue was with my USB Cable. I was using the USB cable of Blackberry Phone. To resolve this issue i just changed the USB Cable with Android's USB cable(The cable that comes with new Android Phone) and every thing started working fine.

Yasir Ali
  • 1,785
  • 1
  • 16
  • 21
0

If you are running on Mac OS Sierra and Android Studio 2.1.2 or 2.2.0 then just upgrade your SDK-Platform Tools to 24.0.4 and Restart Android Studio. This will fix it.

Midhun Vijayakumar
  • 2,927
  • 2
  • 19
  • 23
0

The following two solutions worked for me.

You can try either of the two or both of them.

  1. Restart device.
  2. Free some internal storage space (Works in most of the cases).
vbp
  • 1,157
  • 10
  • 16