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


  原本是想跑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端口,可以參考本博客另外 一篇文章:

http://blog.csdn.net/liranke/article/details/4999210

在這個文章里,詳細說明了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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM