Android控制台:
[2012-06-27 10:58:14 - ChinaWeather] ------------------------------
[2012-06-27 10:58:14 - ChinaWeather] Android Launch!
[2012-06-27 10:58:14 - ChinaWeather] The connection to adb is down, and a severe error has occured.
[2012-06-27 10:58:14 - ChinaWeather] You must restart adb and Eclipse.
[2012-06-27 10:58:14 - ChinaWeather] Please ensure that adb is correctly located at 'D:\softDev\android-sdk-windows\platform-tools\adb.exe' and can be executed.
DDMS控制台:
[2012-06-27 10:58:16 - adb] ADB server didn't ACK
[2012-06-27 10:58:16 - adb] * failed to start daemon *
問題的表現:無法啟動adb,之前調試的時候都是好好的,今天就沒法用了。
在網上搜的結果:
1. 關閉eclipse,在taskmanager中找到adb,結束掉,重啟eclipse
或者,關閉eclipse,在命令列輸入:adb kill-server,重啟eclipse
這種方案對我的情況無效,我在工作管理員裡沒有找到abd,它根本就沒啟動起來
2. 又找到幾篇文章說,HTC的什麼軟體( HTC Sync )會佔用adb啟動並執行連接埠5037,使adb無法運行,我倒是沒有裝過HTC,不過最近裝了豌豆莢
看了下系統啟動選項,豌豆莢居然加了一個***-help的東西隨系統啟動,在工作管理員中結束掉,同時結束掉所有wandoujia的進程,重啟eclipse
運行程式,run android application,控制台還是列印錯誤資訊
The connection to adb is down, and a severe error has occured.
……
不過,這次DDMS沒有錯誤資訊了,這麼說wandoujia是有影響的,看了下工作管理員,有adb進程,可是為什麼還是連不到呢。
在命令列輸入 adb kill-server試試,
輸完後,DDMS的控制台有列印:
[2012-06-27 11:32:06 - DeviceMonitor] Adb connection Error:遠程主機強迫關閉了一個現有的串連。
[2012-06-27 11:32:08 - DeviceMonitor] Connection attempts: 1
[2012-06-27 11:32:10 - DeviceMonitor] Connection attempts: 2
[2012-06-27 11:32:12 - DeviceMonitor] Connection attempts: 3
……
有反應, 在命令列繼續輸入: adb start-server
DDMS控制台停止列印
再次運行程式,沒有錯誤資訊,貌似成功了……
結論: adb的運行連接埠被佔用,無法啟動,我的環境裡是豌豆莢的進程佔用了連接埠,結束掉佔用連接埠的進程,重啟eclipse,重啟adb。