解决“adb server is out of date. killing... ”的办法

有时候ADB不能用,并且会报以下的错误:
C:\Users\gaojs>adb devices
adb server is out of date.  killing...
ADB server didn't ACK
* failed to start daemon *
error: unknown host service

用如下的命令,发现5037的端口被占用:
C:\Users\gaojs>adb nodaemon server
cannot bind 'tcp:5037'

用如下的命令,能查到什么进程占用了这个端口:
C:\Users\gaojs>netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       21152
  TCP    127.0.0.1:5037         127.0.0.1:62629        ESTABLISHED     21152
  TCP    127.0.0.1:5037         127.0.0.1:63942        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:63943        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:63944        TIME_WAIT       0
  TCP    127.0.0.1:62629        127.0.0.1:5037         ESTABLISHED     2980

用如下命令,可以看到上述PID的进程,到底是什么了:
C:\Users\gaojs>tasklist | findstr "2980"
QQ.exe                        2980 Console                    4     60,712 K
C:\Users\gaojs>tasklist | findstr "21152"
tadb.exe                     21152 Console                    4      2,136 K
原来是腾讯这个无耻的家伙(tadb就是Tencent Adb)!

用如下的命令,将tadb.exe(PID:21152)杀掉:
C:\Users\gaojs>taskkill /f /pid 21152

然后,再试,就可以了:
C:\Users\gaojs>adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
4dfadcb86b00cf05        device

转载于:https://www.cnblogs.com/lance-1221/p/9549719.html

你可能感兴趣的:(网络)