在Eclipse中随机脱机(并多次脱机)的设备——修复了吗?

时间:2021-03-20 20:53:13

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).

这个问题困扰了我很长时间,我似乎无法修复它,也无法完全本地化问题的根源(尽管有时我可以通过在连接到Eclipse时允许手机进行备份来强制这么做,但有时这甚至不会造成问题)。

Let's go through the steps.

让我们看看这些步骤。

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

我把我的设备连接起来,它就会弹出,看起来运行良好:

在Eclipse中随机脱机(并多次脱机)的设备——修复了吗?

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

我双击它,以确保LogCat记录它在2件事情中发生的1点:

  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

    这似乎是可行的,我切换到LogCat窗口,在一堆文本中滑动,然后变成白色,我切换回设备,看看

  2. Device goes offline immediately

    设备脱机时立即

在Eclipse中随机脱机(并多次脱机)的设备——修复了吗?

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):

现在,如果我离开它一段时间,在Eclipse周围做一些随机的事情,脱机设备的数量会慢慢增加(它们都有相同的ID,我的):

在Eclipse中随机脱机(并多次脱机)的设备——修复了吗?

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服务器。我通过使用命令做到了:

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...

问题是,这很少能解决问题。有时一个完整的PC重启会修复它,但并不总是……

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.

编辑:天哪,这太烦人了!编辑2:尽快增加赏金。

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.

编辑3:可能是由于我们的机器位于另一个房间以降低我们办公室的噪音和热量水平,它是通过USB集线器连接的。我已经使它足够稳定,能够快速部署应用程序并进行测试,但有时它仍然会离线。好吧,现在完成我的项目。

20 个解决方案

#1


21  

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.

我只是在家里瞎折腾了一会儿,然后第一次注意到这种行为。后阅读(特别是USB插头)的建议,我认为手头的USB电缆我很懦弱,我抓起电缆通常用于工作(这是一个更大的直径,内部不知道这意味着什么),从那以后,一切都工作正常。

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

所以,对于任何有这些麻烦的人,你也可以检查一下,确保不是USB线。

#2


18  

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

在设置中切换“USB调试”对我来说是有效的。

#3


9  

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

我的情况是……Nexus-4,Android版本。4.2.2由于Android 4.2.2的安全增强,我的设备处于离线状态。

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.

Android 4.2.2引入了安全的USB调试,在启用时确保只有用户授权的主机能够使用Android SDK附带的ADB工具访问USB连接设备的内部。

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

更新你的SDK,接受你手机上的RSA密钥。

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

http://www.infoq.com/news/2013/02/android-4-2-2 http://www.androidcentral.com/semi - pro -提示- android - 422在这里-你- android - sdk -可能需要更新

#4


8  

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

我也有类似的问题。我只是把电缆插进usb2端口而不是usb3。

#5


4  

If your platform and platform-tools path is set:

设置平台和平台工具路径:

Then from command prompt:

然后从命令提示符:

adb kill-server

亚行kill-server

    adb start-server

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

当它重新启动带有特定端口的守护进程时,它一定会解决这个问题。

#6


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.

确保你没有HTC Sync或三星Kies试图窃取adb连接。如果您这样做,只需在调试时停止它们。

#7


3  

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

试试这两件事,现在一切都对我有利:

  1. Install the device's manufacturer USB Drivers.

    安装设备的制造商USB驱动器。

  2. Replace the data cable you are using.

    替换您正在使用的数据线。

#8


1  

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

我也有这个问题,有时候它会帮助我们把它连接到另一个usb端口。

#9


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

这是因为堆栈/堆栈溢出。1。关掉并打开你的Android设备2。重新启动ADB服务器(ADB -kill server和ADB -start服务器)3。检查已安装的SD卡并检查USB调试

#10


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.

我有这个问题很长时间了,现在我找到了适合我的解决方案。在DDMS透视图中有一个设备上的箭头选项卡,该选项卡具有“重置adb”选项。这一行动解决了我的问题。

#11


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...

我在这种情况下已经有过很多次了,上面的许多解决方案通常都是有效的。今天,他们都没有成功。重新启动ADB服务器,关闭USB调试,尝试不同的电缆和端口,重新安装驱动程序,重新启动计算机。在其他电脑上也遇到过同样的问题。没有运气…

Solution for me: Restarted the android device.

解决方案:重启安卓设备。

#12


0  

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

我刚刚通过重启Android手机解决了这个问题。希望对你有用。

#13


0  

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.

以上的一些建议有时会有所帮助,但并非始终如一。和许多人一样,我也怀疑过USB电缆,但最终我认定,这是我的Android设备上的USB接口,只是因为使用太多而磨损了。我想他们应该每天充电一到两次,而不是每周5天充电10次。在这种情况下,一根新的电缆可能会有所帮助,但除了新设备之外,可能没有更好的解决方案。

#14


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:

我也到处寻找解决这个问题的办法。在准备通过adb/USB编译和运行我的项目时,我的问题描述如下:

  • I would 'Run' or Cntrl-F11, for the Android Device Chooser window to pop-up
  • 我会“运行”或Cntrl-F11,让Android设备选择器窗口弹出
  • plug in my Samsung Galaxy Nexus
  • 插上我的三星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.

我尝试重新安装不同来源的驱动,甚至尝试了5种不同的USB线。但最终,修复它的办法是把USB数据线插进我电脑后面板上的一个免费USB接口,而不是把它插在前面更容易访问的地方。

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.

然而,这个问题只发生在我的三星Galaxy Nexus上(它是基于Android的,目前运行的是Codename Android ROM),而不是HTC Nexus One(运行的是CyanogenMod)。我的N1就算插在前面的USB面板上也会一直在线。

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.

因此,现在我还在运行Android SDK附带的ADB驱动程序,我的PC是自建的(运行Asus P5Q Pro主板<-这里可能是罪魁祸首),我的OS是Win7 64位的。而且我的两部手机都与adb保持在线连接。

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

因此,我建议有类似问题的用户尝试不同的电缆和USB接口。

#15


0  

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

galaxy s2 / windows 7 / eclipse juno关闭usb调试也有同样的问题,有时还会破坏和重新启动adb接缝

#16


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.

我遇到过类似的断开连接问题,在重新启动后不久连接就丢失了。在我的LG VS840 4G手机上,USB连接模式从大容量存储器转变为互联网连接,这对我很有帮助。app Key >设置> Connectivity >默认连接方式> Internet连接。

#17


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.

更改usb端口对我来说是可行的,还可以检查您是否正在使用usb hub来连接设备。前usb接口和后usb端口也有影响。最好使用usb接口。

#18


0  

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.

在我的例子中,脱机模式的问题是手机插入USB 3.0端口/USB集线器。当我将它移动到USB 2.0端口时,它就可以正常工作了。

#19


0  

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

2016年,这个问题依然存在,使用联想设备android 4.4.2。大多数被提议的解决方案“有时”起作用。

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.

对我有用的是安装了Wifi ADB (app),它甚至把我从usb数据线的限制中解放出来。顺便说一句,这款设备不会出现在android设备监视器中,但会在运行app Shift+f10时出现。

#20


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.

我不确定是否有人会觉得这个答案有价值,但我有一个类似的情况,我的设备在线,然后随机离线。我尝试了一些东西,比如检查电缆、adb killserver等等。最终对我起作用的是重新启动我的电脑和手机。我觉得只有当你发现你的设备在之前运行正常的时候突然离线时,它才适用。

#1


21  

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.

我只是在家里瞎折腾了一会儿,然后第一次注意到这种行为。后阅读(特别是USB插头)的建议,我认为手头的USB电缆我很懦弱,我抓起电缆通常用于工作(这是一个更大的直径,内部不知道这意味着什么),从那以后,一切都工作正常。

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

所以,对于任何有这些麻烦的人,你也可以检查一下,确保不是USB线。

#2


18  

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

在设置中切换“USB调试”对我来说是有效的。

#3


9  

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

我的情况是……Nexus-4,Android版本。4.2.2由于Android 4.2.2的安全增强,我的设备处于离线状态。

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.

Android 4.2.2引入了安全的USB调试,在启用时确保只有用户授权的主机能够使用Android SDK附带的ADB工具访问USB连接设备的内部。

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

更新你的SDK,接受你手机上的RSA密钥。

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

http://www.infoq.com/news/2013/02/android-4-2-2 http://www.androidcentral.com/semi - pro -提示- android - 422在这里-你- android - sdk -可能需要更新

#4


8  

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

我也有类似的问题。我只是把电缆插进usb2端口而不是usb3。

#5


4  

If your platform and platform-tools path is set:

设置平台和平台工具路径:

Then from command prompt:

然后从命令提示符:

adb kill-server

亚行kill-server

    adb start-server

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

当它重新启动带有特定端口的守护进程时,它一定会解决这个问题。

#6


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.

确保你没有HTC Sync或三星Kies试图窃取adb连接。如果您这样做,只需在调试时停止它们。

#7


3  

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

试试这两件事,现在一切都对我有利:

  1. Install the device's manufacturer USB Drivers.

    安装设备的制造商USB驱动器。

  2. Replace the data cable you are using.

    替换您正在使用的数据线。

#8


1  

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

我也有这个问题,有时候它会帮助我们把它连接到另一个usb端口。

#9


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

这是因为堆栈/堆栈溢出。1。关掉并打开你的Android设备2。重新启动ADB服务器(ADB -kill server和ADB -start服务器)3。检查已安装的SD卡并检查USB调试

#10


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.

我有这个问题很长时间了,现在我找到了适合我的解决方案。在DDMS透视图中有一个设备上的箭头选项卡,该选项卡具有“重置adb”选项。这一行动解决了我的问题。

#11


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...

我在这种情况下已经有过很多次了,上面的许多解决方案通常都是有效的。今天,他们都没有成功。重新启动ADB服务器,关闭USB调试,尝试不同的电缆和端口,重新安装驱动程序,重新启动计算机。在其他电脑上也遇到过同样的问题。没有运气…

Solution for me: Restarted the android device.

解决方案:重启安卓设备。

#12


0  

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

我刚刚通过重启Android手机解决了这个问题。希望对你有用。

#13


0  

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.

以上的一些建议有时会有所帮助,但并非始终如一。和许多人一样,我也怀疑过USB电缆,但最终我认定,这是我的Android设备上的USB接口,只是因为使用太多而磨损了。我想他们应该每天充电一到两次,而不是每周5天充电10次。在这种情况下,一根新的电缆可能会有所帮助,但除了新设备之外,可能没有更好的解决方案。

#14


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:

我也到处寻找解决这个问题的办法。在准备通过adb/USB编译和运行我的项目时,我的问题描述如下:

  • I would 'Run' or Cntrl-F11, for the Android Device Chooser window to pop-up
  • 我会“运行”或Cntrl-F11,让Android设备选择器窗口弹出
  • plug in my Samsung Galaxy Nexus
  • 插上我的三星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.

我尝试重新安装不同来源的驱动,甚至尝试了5种不同的USB线。但最终,修复它的办法是把USB数据线插进我电脑后面板上的一个免费USB接口,而不是把它插在前面更容易访问的地方。

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.

然而,这个问题只发生在我的三星Galaxy Nexus上(它是基于Android的,目前运行的是Codename Android ROM),而不是HTC Nexus One(运行的是CyanogenMod)。我的N1就算插在前面的USB面板上也会一直在线。

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.

因此,现在我还在运行Android SDK附带的ADB驱动程序,我的PC是自建的(运行Asus P5Q Pro主板<-这里可能是罪魁祸首),我的OS是Win7 64位的。而且我的两部手机都与adb保持在线连接。

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

因此,我建议有类似问题的用户尝试不同的电缆和USB接口。

#15


0  

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

galaxy s2 / windows 7 / eclipse juno关闭usb调试也有同样的问题,有时还会破坏和重新启动adb接缝

#16


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.

我遇到过类似的断开连接问题,在重新启动后不久连接就丢失了。在我的LG VS840 4G手机上,USB连接模式从大容量存储器转变为互联网连接,这对我很有帮助。app Key >设置> Connectivity >默认连接方式> Internet连接。

#17


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.

更改usb端口对我来说是可行的,还可以检查您是否正在使用usb hub来连接设备。前usb接口和后usb端口也有影响。最好使用usb接口。

#18


0  

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.

在我的例子中,脱机模式的问题是手机插入USB 3.0端口/USB集线器。当我将它移动到USB 2.0端口时,它就可以正常工作了。

#19


0  

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

2016年,这个问题依然存在,使用联想设备android 4.4.2。大多数被提议的解决方案“有时”起作用。

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.

对我有用的是安装了Wifi ADB (app),它甚至把我从usb数据线的限制中解放出来。顺便说一句,这款设备不会出现在android设备监视器中,但会在运行app Shift+f10时出现。

#20


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.

我不确定是否有人会觉得这个答案有价值,但我有一个类似的情况,我的设备在线,然后随机离线。我尝试了一些东西,比如检查电缆、adb killserver等等。最终对我起作用的是重新启动我的电脑和手机。我觉得只有当你发现你的设备在之前运行正常的时候突然离线时,它才适用。