Device going offline randomly (and appearing multi

2019-03-14 06:03发布

问题:

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:

  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

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.

回答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, dunno 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.



回答2:

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



回答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



回答4:

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



回答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



回答6:

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.



回答7:

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.



回答8:

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



回答9:

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



回答10:

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.



回答11:

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.



回答12:

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



回答13:

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.



回答14:

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.



回答15:

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



回答16:

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.



回答17:

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.



回答18:

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.



回答19:

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.



回答20:

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.