环境为真机测试,偶尔会报如下错误
- [2012-04-24
20:41:34 - DeviceMonitor]Adb connection Error:远程主机强迫关闭了一个现有的连接。 - [2012-04-24
20:41:36 - DeviceMonitor]Connection attempts: 1 - [2012-04-24
20:41:38 - DeviceMonitor]Connection attempts: 2 - [2012-04-24
20:41:40 - DeviceMonitor]Connection attempts: 3 - [2012-04-24
20:41:42 - DeviceMonitor]Connection attempts: 4 - [2012-04-24
20:41:44 - DeviceMonitor]Connection attempts: 5 - [2012-04-24
20:41:46 - DeviceMonitor]Connection attempts: 6 - [2012-04-24
20:41:48 - DeviceMonitor]Connection attempts: 7 - [2012-04-24
20:41:50 - DeviceMonitor]Connection attempts: 8 - [2012-04-24
20:41:52 - DeviceMonitor]Connection attempts: 9 - [2012-04-24
20:41:54 - DeviceMonitor]Connection attempts: 10 - [2012-04-24
20:41:56 - DeviceMonitor]Connection attempts: 11 - [2012-04-24
20:44:06 - ddms]ADB rejected shell command (ls -l /): closed - [2012-04-24
20:44:11 - ddms]ADB rejected shell command (ls -l /): closed
之前都是重启eclipse解决,但偶尔还解决不了。对于真机需要拔掉数据线,关闭eclipse重启,重新连接手机解决。
但由于eclipse实在过于笨重,关闭重启时间过长。找到另外一种解决方法:
eclipse中视图模式选择DDMS(还有常见的java和debug视图), 显示Devices窗口,若无可通过选择window->show view->Devices显示,再选择下拉箭头中的reset adb。
此时eclipse会再自动重试一次,输入Connection attempts:1即表示成功啦