Android开发abd相关异常:Adb connection Error:远程主机强迫关闭了一个现有的连接

Android开发abd相关异常:Adb connection Error:远程主机强迫关闭了一个现有的连接

本文主要解决adbconnectionerror的问题——resetadb.

环境为真机测试,偶尔会报如下错误

Java代码 收藏代码

[2012-04-2420:41:34-DeviceMonitor]AdbconnectionError:远程主机强迫关闭了一个现有的连接。

[2012-04-2420:41:36-DeviceMonitor]Connectionattempts:1

[2012-04-2420:41:38-DeviceMonitor]Connectionattempts:2

[2012-04-2420:41:40-DeviceMonitor]Connectionattempts:3

[2012-04-2420:41:42-DeviceMonitor]Connectionattempts:4

[2012-04-2420:41:44-DeviceMonitor]Connectionattempts:5

[2012-04-2420:41:46-DeviceMonitor]Connectionattempts:6

[2012-04-2420:41:48-DeviceMonitor]Connectionattempts:7

[2012-04-2420:41:50-DeviceMonitor]Connectionattempts:8

[2012-04-2420:41:52-DeviceMonitor]Connectionattempts:9

[2012-04-2420:41:54-DeviceMonitor]Connectionattempts:10

[2012-04-2420:41:56-DeviceMonitor]Connectionattempts:11

[2012-04-2420:44:06-ddms]ADBrejectedshellcommand(ls-l/):closed

[2012-04-2420:44:11-ddms]ADBrejectedshellcommand(ls-l/):closed

之前都是重启eclipse解决,但偶尔还解决不了。对于真机需要拔掉数据线,关闭eclipse重启,重新连接手机解决。

但由于eclipse实在过于笨重,关闭重启时间过长。找到另外一种解决方法:

eclipse中视图模式选择DDMS(还有常见的java和debug视图),显示Devices窗口,若无可通过选择window->showview->Devices显示,再选择下拉箭头中的resetadb

Android开发abd相关异常:Adb connection Error:远程主机强迫关闭了一个现有的连接


此时eclipse会再自动重试一次,输入Connectionattempts:1即表示成功啦



你可能感兴趣的:(Connection)