59

I'm not 100% sure if this should go here or the main Stack Overflow, but I decided to go with this area in hope I might catch someone with more specific experience with a similar problem.

I have a Samsung Captivate (love it minus it's crappy GPS). I do development for it from 2 different computers, one at home, one at work. The machines are both Windows XP, Service Pack 3, 32 bit. I have the same Samsung drivers installed, same versions of Eclipse, etc. The phone is currently rooted running the Serendipity mod, though this issue was exactly the same on the stock firmware.

My home machine (the problem one) is an Athlon 64 2.2 Ghz. My work machine is a Core 2 Duo, don't recall the model.

At work, I can do anything, mount the sdcard on the phone and copy easily, use adb to push, pull, uninstall, install. I can debug in ddms, install through Eclipse, etc, etc...

At home, if I reboot both the computer and phone and pull up a command prompt without having Eclipse open, I MIGHT be able to see the device by typing adb devices. Usually then, I can clear the logcat or run the logcat fairly stable. If I open Eclispe (my development IDE) and try to run a new build of an app, I'll generally lose the connection. The same thing happens if I try to copy files either via mounting or using pull with adb. Some files will copy, and suddenly the connection will be gone and the device will show offline to adb, or not in the list at all, or listed offline twice. Rebooting the phone sometimes helps, but not always. There are times I close Eclipse and every other app, reboot my phone and still end up having adb completely unable to detect the device. I'll use adb kill-server and adb start-server but this generally doesn't help. I use Avast for my anti-virus at home, but have tried without any anti-virus installed at all and it's the same. I've recently reinstalled Windows due to a hard drive crash and it was the exact same. I've tried every different USB port on my tower.

I hope VERY much someone can tell me what's wrong as I've been dealing with this for a year and a half now and it's about to make me lose my mind.

-Jeremiah

GAThrawn
  • 22,094
  • 9
  • 79
  • 127
Maximus
  • 691
  • 1
  • 5
  • 4

18 Answers18

38

Switching from USB 3.0 port to USB 2.0 solved the problem for me. Most laptops come with both port types these days.

jaichander
  • 381
  • 3
  • 3
13

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
  • 231
  • 3
  • 6
4

I'm using an LG G3 marshmallow. I don't know why, but when I go to Developer options > Networking section > Select USB Configuration > MTP fixed it.

Before that, whenever I plug my phone to my PC, the driver installation window always froze at the start, but when I changed to MTP connection, the driver installation window immediately recognized it and the phone icon changed to an LG phone icon and finished installing.

4

This was annoying me for ages. Logcat would disappear or the phone would need to be reconnected to the USB for ADB to see it properly.

What worked for me was using one of the rear USB ports on my PC. The front ones probably were going through a dodgy hub or perhaps dodgy USB hub software. So if you are using front USB ports, try the ones on the rear.

geffchang
  • 17,763
  • 18
  • 60
  • 74
lynton
  • 41
  • 1
2

To me it sounds you have some bad hardware or drivers at home. Make sure you don't have anything related to Kies running; Kies + Samsung Windows Drivers seem to cause erratic behavior on USB connection that differs between machines...

Try different USB ports and cables first, tho.

Zds
  • 349
  • 2
  • 8
2

I was having this disconnect-reconnect problem.

I solved my problem in the Windows USB settings :

1- Open device Manager.
2- Human interface Devices.
3- Right click in one of them or double click.
4- go to power management.
5- Uncheck the option of "Allow the computer to turn off this device to save power" than OK.
Note* try to use step #3-5 on all available option*

(from http://www.tomshardware.co.uk/answers/id-1783536/usb-ports-disconnecting-reconnecting.html)

rcperso
  • 121
  • 1
2

I found a very easy solution. Same happened to me in Ubuntu 16.04 system. I applied following command.

adb kill-server
sudo adb start-server

When adb is running as admin it will not throw any error.

1

I used to have the same problems and also my logcat would clear and stop updating in Eclipse, the difference is I was on an official Samsung ROM then. After I switched to Darky's ROM the stability has been much better. Still, every now and then the device disappears, but usually it reappears after reattaching the USB. My PC is a bit different from yours (Atom D525, Win7) so I can confirm it's not restricted to a single device/OS.

I'd suggest reflashing the ROM or updating if possible. Or you could try it with another phone to see if it's an error specific to your phone. On the other hand, ADB isn't the stablest of software, so it could be just annoying hiccups.

aleksikallio
  • 16,330
  • 6
  • 49
  • 73
1

Find the location android-sdk-windows\platform-tools.

Open Command Prompt and then run these commands:

cd c:\android\sdk\android-sdk-windows\platform-tools
adb.exe kill-server
adb.exe start-server

These steps may solve your problem.

Firelord
  • 25,528
  • 21
  • 129
  • 295
msolak
  • 11
  • 1
1

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
  • 111
  • 2
1

It might be because of a windows setting that is (rather stupidly) turned ON by default

Click 'Change advanced power setting' on your chosen plan and expand 'USB Settings'. Under 'USB Settings' section, expand 'USB selective suspend setting' and change it to 'Disabled' for On battery and Plugged In.

All the glory to thewindowsclub

JinSnow
  • 111
  • 6
1

I was having the same issue with my Nexus 4, running Cyogenmod 11 on Windows 8. I was plugging in using a USB splitter and my phone would keep disconnecting within seconds of being recognized by LogCat / DDMS. Switching to a physical port on my machine did the trick. In my case the front USB ports worked fine.

0

Same issue here; I use adb on gnu/linux with no additional drivers.

Workaround Solution: unplug and replug USB

http://forum.xda-developers.com/showthread.php?p=17111464#post17111464

ale
  • 19,737
  • 34
  • 111
  • 161
rzr
  • 103
  • 3
0

A different issue with the same symptoms when updated to MacOS Sierra. Here's a workaround script:

#!/bin/bash

cat << EOF
###########################################################
# Workaround adb disconnecting issue on macOS Sierra
#
# More info:
# https://code.google.com/p/android/issues/detail?id=219085
# credits to: hans...@meetme.com, vs...@google.com
###########################################################

EOF

function monitor_adb () {
  adb start-server
  echo "[$(date)] adb started"

  while [ "$(adb shell echo 1)" ]; do sleep 5; done

  echo "[$(date)] adb is broken, restarting"

  adb kill-server
  adb start-server || adb start-server
  adb reverse tcp:8081 tcp:8081
}

while [ true ]; do time monitor_adb ; done
yanchenko
  • 101
  • 1
0

I had same issue but only with Android 6/7 devices and Mac host. Solution was...switch device from 'Charging' to 'File transfer' mode.

Tauri
  • 101
  • 2
0

Here's my answer with adb pull emulation workaround based on adb and dd. It continuously retries and resumes download when disconnection happens.

alopatindev
  • 51
  • 1
  • 5
0

This will happen each time you leave adb connection open, need to disconnect after using adb session, to disconnect simply run

adb disconnect <ipaddress>

you replace ipaddress with ip of android device, same as adb connect.

haytham-med
  • 101
  • 1
0

adb on Debian/Ubuntu is currently as 1.0.29 connecting to android 4.2.2+ devices requires 1.0.31 which causes this error

https://bugs.launchpad.net/ubuntu/+source/android-tools/+bug/1131163

you can either manually install the latest android development kit or wait until the debian folks upgrade teh package

Arthur Ulfeldt
  • 272
  • 3
  • 9