Device going offline randomly (and appearing multiple times as offline) in Eclipse - fixes?
Solution 1
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.
Solution 2
Toggle on/off for 'USB Debugging' in settings worked for me.
Solution 3
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
Solution 4
I had a similar problem. I just solved it by plugging in the cable into the usb2 port instead of usb3.
Solution 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
Related videos on Youtube
Codemonkey
Updated on February 22, 2021Comments
-
Codemonkey over 3 years
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:
I double-click it to ensure LogCat is logging it at which point 1 of 2 things happen:
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
Device goes offline immediately
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):
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.
-
Reno over 13 years@Klaus mention the device you are using, it'll be of help.
-
Codemonkey over 13 yearsHnnngh - I had that in my notepad version of the question but apparently missed it somehow. It's a Samsung Galaxy S with Froyo.
-
Kevin over 13 yearsHTC 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.
-
Codemonkey over 13 yearsYeah 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.
-
WarrenFaith over 13 yearshave you tried to use logcat without eclipse? I dismissed the logcat view because its to buggy..
-
Geltrude over 12 yearsI've the same annoying problem :-( WIN7 64bit + Android 2.3.3 + HTC DESIRE ROOTED
-
wojciii almost 12 yearsIf the problem is unstable USB, you could try to use adb over TCP/IP instead of USB.
-
Jon Watte over 10 yearsThis 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.)
-
Codemonkey over 13 yearsYeah, 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 over 13 yearsDisregard the above, this is still driving me crazy.
-
sXe over 12 yearsThe 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!!
-
Melinda Green over 12 yearsI 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.
-
TwainJ over 12 yearsThanks! Glad it was helpful! I agree, Wifi debugging would be handy at times.
-
Jon Watte over 10 yearsFrom looking at the various posts about this, I think this is a Samsung value-added "feature."
-
Arpit Garg over 10 years@JonWatte If you are using windows environment,go to task manager kill the process "adb.exe" and use the above commands again.
-
kakhkAtion over 8 yearsIt 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!
-
tricknology over 7 yearsHaha, It was the cable. Thanks!
-
TwainJ almost 7 yearsI'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: amzn.to/2r1WjQq I was astounded how much there is to know.