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


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

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

     

     1.错误信息:

    C:Usersadmin>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:Usersadmin>adb nodaemon server
    cannot bind 'tcp:5037' 

    提示:无法绑定5037端口

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

    C:Usersadmin>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:Usersadmin>tasklist | findstr "10760"
    PPAdbServer.exe 10760 Console 1 6,044 K

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

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

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

      方法2:taskkill /f /pid 10760

      C:Usersadmin>taskkill /f /pid 10760

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

    4. 重现启动adb

    C:Usersadmin>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

  • 相关阅读:
    ReentrantLock重入锁
    Java对象序列化和反序列
    echarts踩坑笔记
    金融风控之贷款违约预测笔记
    go安装模块
    vasp计算轨道吸附
    html
    css/js 小技巧
    python 调用父类方法:super && 直接使用父类名
    python 多线程
  • 原文地址:https://www.cnblogs.com/jintianniu/p/9913566.html
Copyright © 2020-2023  润新知