一、情況描述:
我們在使用eclipse開發有時候會出現adb連接異常中,有時候控制台會打印出來 adb connect異常
比如會出現下面這樣 :
[2014-12-18 16:18:26 - ] The connection to adb is down, and a severe error has occured. [2014-12-18 16:18:26 - ] You must restart adb and Eclipse. [2014-12-18 16:18:26 - ] Please ensure that adb is correctly located at 'E:\adt-bundle-windows-x86_64-20140624\sdk\platform-tools\adb.exe' and can be executed.
二、解決辦法
這些大多數是其它程序占用了5037端口導致的,解決問題的思路就是查看是哪個程序占用了adb調試端口,然后結束掉它就行。
使用命令如下:
netstat -aon|findstr "5037"
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 18212
tasklist|findstr "18212"
kadb.exe 18212 Console 1 1,260 K
大家能夠看到是一個叫着kadb.exe的程序在占用我們的adb端口,進入到任務管理器里面,找到它結束掉就行了。
1.關閉kadb.exe
2.adb kill-server
3.adb start-server
4.重啟Eclipse