在执行adb devices时发现端口被占用
C:\Users\Administrator>adb devices
* daemon not running; starting now at tcp:5037
发现杀死adb后是一点用没有!!
C:\Users\Administrator>adb kill-server
C:\Users\Administrator>adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
这便尝试占用5037的程序有哪些,执行netstat -aon|findstr "5037",发现有个960的程序占用5037端口
:\Users\Administrator>netstat -aon|findstr "5037"
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 960
TCP 127.0.0.1:5037 127.0.0.1:51392 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:51400 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:51401 TIME_WAIT 0
于是,查询960是哪个程序占用的,执行 tasklist|findstr "960",发现有四个程序,只终止adb.exe没用,这四个必须都杀死才可以
C:\Users\Administrator>tasklist|findstr "960"
svchost.exe 1368 Services 0 1,960 K
svchost.exe 2960 Services 0 1,796 K
chrome.exe 7960 Console 1 28,664 K
adb.exe 960 Console 1 11,516 K
依次执行 taskkill /f /t /im XXX.exe
C:\Users\Administrator>taskkill /f /t /im adb.exe
成功: 已终止 PID 960 (属于 PID 10020 子进程)的进程。
再重新连接,查看连接adb终于好了!!
C:\Users\Administrator>adb devices
List of devices attached
127.0.0.1:62001 device