57

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

5
  • 1
    I have a similar problem, but it's just a loose connection on the cable I use at home
    – cjk
    Commented Aug 16, 2011 at 10:18
  • 2
    When I detach and reattach my usb cable, the problem goes away. Don't know if this is a cable problem or some kind of timeout problem. Any clues ? Commented Dec 29, 2013 at 1:05
  • 1
    This happens to me all the time but, for whatever reason, only when I'm debugging in the car. Weird. Commented Apr 3, 2015 at 20:39
  • My USB cable that shipped with the device is notorious for this problem when debugging. Charging is fine though. Anyway, I swapped to my old (and incidentally shorter) USB cable and now it's working.
    – user25780
    Commented Jul 24, 2018 at 9:01
  • Same issue with Pixel 2 and Macbook Pro 15 inch 2018. My USB C to USB type C cable is the original one from Google
    – ericn
    Commented Sep 10, 2019 at 7:09

18 Answers 18

37

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

5
  • 1
    you saved my day. Old phones keeped disconnecting on usb 3 when installing APK
    – Climbatize
    Commented May 25, 2016 at 7:22
  • Same issue for me. It was a newer device too ... However, it constantly disconnected when plugged into a 3.0 port. Moving it to a 2.0 port worked great. Commented Jun 28, 2017 at 1:01
  • It's amazing, I never think that the problem lies on usb port.
    – fangzhzh
    Commented Aug 25, 2017 at 2:28
  • 1
    Yep. Had the same problem as @Climbatize. Had to swap USB ports around until I found one that the device liked. Newer devices have no issues on the same port(s), but the older device would disconnect every time Android Studio tried to install an APK.
    – aroth
    Commented May 22, 2019 at 5:37
  • tried a different usb-port and it works!
    – Lydon Ch
    Commented Dec 29, 2020 at 17:52
12

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.

5
  • 1
    Interesting. Anyone else out there have problems with macintosh portables not supplying enough power to connected devices?
    – SMBiggs
    Commented May 27, 2015 at 15:14
  • 2
    You don't need WIFI for tcp ip adb. only need to have a working usb adb first to make the adb on the phone listen on tcp/ip. with it connected on usb adb, type adb tcpip 5555 , disconnect usb, type adb connect your.phone.ip.number Commented Apr 29, 2016 at 5:22
  • I can’t believe I only came across this today. I have a MacBook Pro (Retina, 15-inch, Late 2013) and I’ve had this issue for months and searched all over the internet. My Galaxy S6 would randomly disconnect (often within a fraction of a second, always within about a minute of connecting). I just plugged it in via a powered USB hub and bam! It just works. Thanks, @grebulon. Commented May 17, 2016 at 9:28
  • Not sure if that's related or not, but simply switching from the left USB port to the right USB port on a MacBook Pro (Retina, 15-inch, 2012) apparently solved the issue!
    – jcaron
    Commented Feb 9, 2017 at 13:04
  • This solved the issue for me and I am running a PC with 8 USB devices. I added the powered hub and everything worked great.
    – James
    Commented Jun 5, 2023 at 16:40
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.

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.

1
  • 1
    Awesome! I Try all the hell of comments here and nothing fix it. This was just a charm! I put the option ""Charging" and fix it, must be some weird issue, but for now works! you safe my life Daniel!
    – jfcogato
    Commented Jul 4, 2018 at 12:13
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.

1
  • I tend to agree here... I feel there basically has to be something up/incompatible with my home computer (board/cpu/usb ports). I've had no trouble with any other usb devices though... I use the same cable in both places... so well... I think I'm just screwed. I've been a hair away from upgrading my home machine with a new mobo... so I think that's going to just have to happen. It sucks though, I honestly don't have a need for a faster machine, the development I isn't particularly intense...
    – Maximus
    Commented Aug 16, 2011 at 17:57
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)

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.

1
  • I might try a buddies Vibrant... that is a thought... still, I'm not sure about the Rom being an issue since everything has behaved exactly the same on both the stock firmware and Serendipity... though I have been curious to try Firefly... we'll see.
    – Maximus
    Commented Aug 16, 2011 at 18:01
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.

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).
1
  • Free some internal storage space - surprisingly this worked for me
    – staafl
    Commented Jan 19, 2021 at 16:07
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.

3
  • dont forget, your android-sdk-windows directory maybe different. so you must change string by yourself => c:\android\sdk\android-sdk-windows\platform-tools
    – msolak
    Commented Jan 30, 2016 at 0:38
  • 2
    OP wrote: "I'll use adb kill-server and adb start-server but this generally doesn't help".
    – Firelord
    Commented Jan 30, 2016 at 0:47
  • This is a workaround, not a solution.
    – dm78
    Commented Feb 1, 2016 at 19:52
1

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

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

1
  • 1
    Holly cow, I was having this issue on my desktop computer just by starting adb server and without devices connected (don't even talk about debugging) and this setting fixed it
    – oamilkar
    Commented Jun 28, 2022 at 22:17
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

2
  • Currently, my working method is to (and I still think this sucks) is to build, close Eclipse and plug and unplug till entering adb devices shows the device. If I have more than one showing, adb kill-server, then plug in and adb devices. Extremely tedious.
    – Maximus
    Commented Oct 8, 2011 at 20:15
  • 2
    Frustratingly, this link goes to a forum, which has a link to another stack exchange site, which links to this thread.
    – bahamat
    Commented Feb 20, 2013 at 21:59
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

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: [email protected], [email protected]
###########################################################

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
2
  • This doesn't work for me. The kill/start just loops with no luck. MBP Retina 2015 Yosemite with S6 Edge FYI. Commented Oct 4, 2016 at 19:53
  • 1
    This should no longer be needed. Bug is fixed in 24.0.4 or later. As seen here: code.google.com/p/android/issues/detail?id=219085
    – nilsi
    Commented Oct 16, 2016 at 9:11
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.

0

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

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .