当前位置: 移动技术网 > 移动技术>移动开发>Android > adb server is out of date. killing完美解决

adb server is out of date. killing完美解决

2018年11月06日  | 移动技术网移动技术  | 我要评论

  原本是想跑monkey测试的,可使用adb命令时提示:adb server is out of date. killing...    

  出现这个问题的原因是:adb使用的端口5037被占用了。下面我们说下如何找到是哪个程序占用了这个端口,顺便看看cmd里面的一些类似linux的进程操作。

 

 1.错误信息:

c:\users\admin>adb shell monkey -help
adb server is out of date. killing...
adb server didn't ack
* failed to start daemon *
error: unknown host service

2. 原因:

adb的端口(5037)被占用了。至于这个5037端口,可以参考本博客另外 一篇文章:

在这个文章里,详细说明了adb的原理及其源码分析。

3. 解决办法:

(1)查看adb的端口号是多少: adb nodaemon server

c:\users\admin>adb nodaemon server
cannot bind 'tcp:5037' 

提示:无法绑定5037端口

(2)查找5037端口占用的进程 :netstat -ano | findstr "5037"

c:\users\admin>netstat -ano | findstr "5037"
tcp 127.0.0.1:5037 0.0.0.0:0 listening 10760
tcp 127.0.0.1:5037 127.0.0.1:53437 time_wait 0
tcp 127.0.0.1:5037 127.0.0.1:53440 time_wait 0
tcp 127.0.0.1:5037 127.0.0.1:53445 time_wait 0

(3)找到占用端口进程对应的应用程序 :tasklist | findstr "10760"

c:\users\admin>tasklist | findstr "10760"
ppadbserver.exe 10760 console 1 6,044 k

(4)此时有2个方法杀死进程:

  方法1,通过任务管理器,进程中找到ppadbserver.exe ,结束进程即可。此方法省事高效。

  如果想多学习cmd命令,可以用下面方法

  方法2:taskkill /f /pid 10760

  c:\users\admin>taskkill /f /pid 10760

  成功: 已终止 pid 为 10760 的进程。

 

4. 重现启动adb

c:\users\admin>adb shell monkey -help
usage: monkey [-p allowed_package [-p allowed_package] ...]
[-c main_category [-c main_category] ...]
[--ignore-crashes] [--ignore-timeouts]
[--ignore-security-exceptions]
[--monitor-native-crashes] [--ignore-native-crashes]
[--kill-process-after-error] [--hprof]

 

参考文档:https://blog.csdn.net/liranke/article/details/42524851

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网