1. 程式人生 > >啟動adb 報錯:埠被佔用

啟動adb 報錯:埠被佔用

啟動adb 報錯:

C:\Users\Administrator>adb devices
List of devices attached
* daemon not running. starting it now at tcp:5037 *
error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037:
通常每個套接字地址(協議/網路地址/埠)只允許使用一次。 (10048)

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon
解決辦法:
C:\Users\Administrator>netstat -ano | findstr "5037"      //查詢5037端口占用的程序
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       3820
C:\Users\Administrator>tasklist | findstr 3820             //從程序號查找出程序的具體資訊,在控制檯將其kill掉
tadb.exe                      3820 Console                    1      7,208 K

C:\Users\Administrator>adb devices
List of devices attached
adb server version (31) doesn't match this client (39); killing...
error: protocol fault (couldn't read status): Connection reset by peer
* daemon started successfully *
A10ABMKSJTUK    device

埠被佔用,查程序,殺程序:

  1. 根據埠號查程序號:netstat -ano | findstr 埠號
  2. 根據程序號查程式名字:tasklist | findstr 程序號
  3. 強制、遞迴 刪除本程式及其子程序:taskkill -f -t -im 檔名