46

This problem has been bugging me for ages and I can't seem to fix it or fully localize the source of the problem (although at times I can force it by allowing the phone to Standby while connected to Eclipse, but sometimes that doesn't even cause a problem).

Let's go through the steps.

I connect my device, it pops up and seems to be working fine:

http://i56.tinypic.com/tarkwl.jpg

I double-click it to ensure LogCat is logging it at which point 1 of 2 things happen:

  1. It seems to work, I swap to LogCat window which sliiides through a bunch of text and then goes white, I swap back to Devices and see

  2. Device goes offline immediately

http://i56.tinypic.com/1z6zakj.jpg

Now if I leave it for a while and do random things around Eclipse, the number of offline devices slowly increase (they all have the same ID, mine):

http://i55.tinypic.com/2hzgv35.jpg

Things that help:

I have Googled and looked at other questions regarding this and only managed to find a few "guides" that tell me to restart the adb server. I've done that through the use of the commands:

adb kill-server
adb start-server

The problem is, that only fixes it very rarely. At times a complete PC reboot will fix it, but not always...

Also, turn off Standby mode on your phone when it's plugged in. For me, this is achieved by going

  • Settings -> Programs -> Development -> Stay Awake

Does anyone have a true solution for this? I've tried most of what I could find on Google and had zero luck yet and it's really starting to annoy me.

EDIT: Holy crap, this is SO ANNOYING! EDIT 2: Adding a bounty to this as soon as I can.

EDIT 3: Probably related to the fact that it's connected through a USB hub as our machines are located in another room to keep noise & heat levels down in our offices. I have gotten it stable enough to deploy applications and test very quickly, but it still goes Offline at times. Oh well, done with my project for now.

Codemonkey
  • 3,392
  • 3
  • 17
  • 24
  • @Klaus mention the device you are using, it'll be of help. – Reno Mar 01 '11 at 13:39
  • Hnnngh - I had that in my notepad version of the question but apparently missed it somehow. It's a Samsung Galaxy S with Froyo. – Codemonkey Mar 01 '11 at 13:40
  • HTC Desire doesn't do this. Although the logcat often starts 'clearing' itself really quickly so you can't see the history. I usually hit the red x to manually clear the logcat and that fixes it for a while. – Kevin Mar 01 '11 at 17:04
  • Yeah Kevin, I'm fairly sure that's just LogCat and Eclipse being funky. And it's not fatal, as you mention. This is really annoying me when I'm debugging. I wonder if this has anything to do with the fact that I connect it through a USB hub (our PCs are located in another room, no noise and heat from them) - it still works fine at times though. – Codemonkey Mar 01 '11 at 18:51
  • 1
    have you tried to use logcat without eclipse? I dismissed the logcat view because its to buggy.. – WarrenFaith Mar 02 '11 at 14:23
  • I've the same annoying problem :-( WIN7 64bit + Android 2.3.3 + HTC DESIRE ROOTED – Geltrude Dec 21 '11 at 14:56
  • If the problem is unstable USB, you could try to use adb over TCP/IP instead of USB. – wojciii Jul 24 '12 at 11:00
  • This happens to me, too, with Samsung Galaxy Note 2, ADK v19, and a direct USB connection to the computer. I'm using adb from the command line (using cordova to develop) so it's not at all related to Eclipse or the ADT plug-in. Un-plugging and re-plugging the phone "fixes" it (and is a pain to do every time I want to re-run an app.) – Jon Watte Jan 30 '14 at 19:07

20 Answers20

27

I was just tinkering around at home with some development, and started noticing this behavior for the first time. After reading through the suggestions (USB plugs in particular), I got to thinking that the USB cable I had at hand is pretty wimpy looking, so I grabbed the cable I normally use for work (it's a larger diameter, I don't know, what that means internally), and since then everything has been working fine.

So for anyone landing here with these troubles, you might also check to make sure it isn't the USB cable.

peterh
  • 9,698
  • 15
  • 68
  • 87
TwainJ
  • 1,121
  • 11
  • 24
  • 1
    I gave you the bounty on this because it was the closest to my conclusion (USB jack on device, not cable). Sure would be nice to be able to debug on any phone over wi-fi instead, no? :-) Anyway, thanks for your answer. – Melinda Green Feb 15 '12 at 22:18
  • 1
    Thanks! Glad it was helpful! I agree, Wifi debugging would be handy at times. – TwainJ Mar 07 '12 at 17:44
  • Haha, It was the cable. Thanks! – tricknology Jan 06 '17 at 18:47
  • I'm amazed at how useful this answer has proved for people over the years (!) - for a small-time SO user like me, anyway. So just a bit of info I found awhile back regarding all that "internal" stuff that I still don't profess to know. There is an Amazon reviewer named Benson that does all things USB cable. Check his reviews: http://amzn.to/2r1WjQq I was astounded how much there is to know. – TwainJ Aug 11 '17 at 21:40
19

Toggle on/off for 'USB Debugging' in settings worked for me.

anargund
  • 3,209
  • 2
  • 19
  • 23
  • The kill/restart sometimes worked, the switching USB ports occasionally worked, and the restarting the phone always worked (but I didn't like to do it). Seems like toggling the USB Debugging works every time, thanks!! – sXe Feb 07 '12 at 22:44
9

My case is...
Nexus-4, Android version. 4.2.2
Because of Security Enhancements in Android 4.2.2, my device was offline.

Android 4.2.2 introduces secure USB debugging which when enabled ensures only host computers authorized by the user can access the internals of a USB connected device using the ADB tool included with the Android SDK.

Update your SDK, accept the RSA key on your phone.

Here is some references.

http://www.infoq.com/news/2013/02/android-4-2-2
http://www.androidcentral.com/semi-pro-tip-android-422-here-your-android-sdk-might-need-updating

Jinbom Heo
  • 6,590
  • 14
  • 48
  • 58
8

I had a similar problem. I just solved it by plugging in the cable into the usb2 port instead of usb3.

Christian Vielma
  • 12,606
  • 12
  • 52
  • 59
5

If your platform and platform-tools path is set:

Then from command prompt:

adb kill-server

    adb start-server

It will definitely solve the problem as it restarts the daemon with the specific port

Arpit Garg
  • 7,934
  • 5
  • 32
  • 59
  • @JonWatte If you are using windows environment,go to task manager kill the process "adb.exe" and use the above commands again. – Arpit Garg Jan 31 '14 at 05:07
  • It won't "definitely" solve the problem! The issue could be something other than the server (e.g. USB cable as others suggested). Also, your solution is in the question and clearly didn't resolve the issue! – kakhkAtion Oct 13 '15 at 23:23
3

Try these two things, now everything is working for me:

  1. Install the device's manufacturer USB Drivers.

  2. Replace the data cable you are using.

Ofir
  • 161
  • 1
  • 4
3

Make sure you don't have HTC Sync or Samsung Kies trying to steal adb connection. If you do, simply stop them when you're debugging.

Erez A. Korn
  • 2,547
  • 2
  • 22
  • 32
  • Yeah, those are not on. I've managed to get it fairly stable by starting it through adb start-server -> adb logcat -> ddms -> then open Eclipse and monitor it. Eclipse does something funky that screws it up I guess. – Codemonkey Mar 02 '11 at 09:21
  • Disregard the above, this is still driving me crazy. – Codemonkey Mar 02 '11 at 14:20
1

I get this problem too, sometime it helps to connect it to another USB-port.

dac2009
  • 3,261
  • 1
  • 17
  • 21
1

This is because of over stack/stack overflow. 1. Switch off and Switch on your Android Device 2. Restart your ADB server(adb -kill server and adb -start sever) 3. Check the mounted SD card and check the USB debug ON

Shriharsh
  • 11
  • 1
1

I had this problem for long time and now I found solution that works good for me. In DDMS perspective there is an arrow on devices tab which has 'Reset adb' option. This action resolved my problem.

Nikola
  • 11
  • 2
1

I have been in this situation a number of times and many of the above solutions usually work. Today none of them worked. Restarted ADB server, toggled USB debugging off and on, tried a different cable and port, re-installed driver, restarted computer. Experienced the same problem on other computers. No luck...

Solution for me: Restarted the android device.

MacNeil
  • 81
  • 1
  • 2
1

In my case the issue with offline mode was the phone being plugged in a USB 3.0 port/USB hub. As soon as I moved it to a USB 2.0 port it worked with no issues.

azertiti
  • 3,090
  • 14
  • 19
1

Some of the above suggestions would help sometimes but not consistently. Like many, I've suspected the USB cables but in the end I've decided that it was the USB jack on my Android device simply wearing out from so much use. I guess they're only meant to be plugged in once or twice a day to charge, and not 10 times a day 5 days a week doing development. In this case a new cable may help but there may be no good solution short of a new device.

Melinda Green
  • 1,970
  • 1
  • 20
  • 32
0

I had a similar disconnect issue in which the connection gets lost soon after a reboot. On my LG VS840 4G phone, changing the USB connection mode from Mass Storage to Internet Connection helped. Apps Key > Settings > Connectivity > Default connection mode > Internet Connection.

Sabre
  • 3,911
  • 5
  • 31
  • 53
0

I also searched high and low for a solution to this problem. The description of my problem when getting ready to compile and run my project over adb/USB:

  • I would 'Run' or Cntrl-F11, for the Android Device Chooser window to pop-up
  • plug in my Samsung Galaxy Nexus
  • the state would show Offline then Online (for varying lengths of time) then Offline again
  • my workaround has been to click fast during the window where it shows Online

I tried reinstalling different drivers suggested by various sources, and even tried 5 different USB cables. But in the end, what fixed it was plugging the USB cable into one of the free USB sockets in the back panel of my PC, instead of the front where it's more accessible.

However, peculiarly this problem only happens with my Samsung Galaxy Nexus (which is rooted and currently running Codename Android ROM) and not with my HTC Nexus One (running CyanogenMod). My N1 would always stay online even if plugged into the front USB panel.

So now I'm still running the ADB drivers that come with the Android SDK, my PC is self-built (running Asus P5Q Pro motherboard <- a likely culprit here), and my OS is Win7 64-bit. And both my phones are staying Online connected to adb.

Thus I suggest those with similar problems to try different cables and USB ports.

Frank Yin
  • 1,779
  • 1
  • 16
  • 12
0

same problem with galaxy s2 / windows 7 / eclipse juno switch off usb debugging helps, somtimes also killing and restarting adb seams to be

0

Changing the usb port worked out for me, also check if you are using usb hubs for connecting the devices. front usb port and back usb ports also make a difference. preferably use back usb port.

sgs
  • 21
  • 1
0

2016 and this problem is still happenning , using Lenovo device android 4.4.2. The majority of proposed solution work 'sometimes'.

Still there is no explanation for this.

What worked for me was installing the Wifi ADB (app) and it even liberated me from usb cable limitations.BTW the device does not appear in android device monitor but appears upon running app Shift+f10.

nassim
  • 308
  • 2
  • 8
0

Not sure if anyone will find this answer valuable, but I had a similar situation, where my device was online, and then randomly went offline. I tried things like checking the cable, adb kill-server, and so on. What finally worked for me was restarting my computer and my phone. I feel like this will only be applicable if you find that your device is suddenly offline, when it was working fine before.

BlackHatSamurai
  • 21,845
  • 20
  • 84
  • 147
0

I just solved the problem by rebooting my Android phone. Hope it works for you.

LazarusX
  • 2,675
  • 2
  • 20
  • 30