1. 程式人生 > >DeviceMonitor Adb connection Error:遠端主機強迫關閉了一個現有的連線 解決方法

DeviceMonitor Adb connection Error:遠端主機強迫關閉了一個現有的連線 解決方法

本文主要解決adb connection error的問題——reset adb.

環境為真機測試,偶爾會報如下錯誤

[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即表示成功啦