• 如果adb devices出现5037端口未被占用依旧显示获取失败,出现以下报错时的解决办法


    问题:

    win7 64位系统使用adb命令连接模拟器,在5037端口未被占用情况下,报以下错误:

       * daemon not running. starting it now on port 5037 *
       CreateProcess failure, error 2
       * failed to start daemon *
       error: cannot connect to daemon

    解决方法:

    1.将本机C:WINDOWSSystem32下的adb.exe文件复制到C:WindowsSysWOW64下
    2.将本机C:WINDOWSSystem32下的AdbWinApi.dll文件复制到C:WindowsSysWOW64下

    解决过程:

    1、初一看应该是5037端口被占用了,一个比较常见的错误,执行命令查看5037端口被谁占用了:netstat -ano | findstr "5037"或执行tasklist | findstr "9244",但是神奇的事情发生了,结果是没有任何程序占用该端口

    2、于是执行adb kill-server ,OK,再执行adb start-server,又提示相同的错误了,adb无法在5037端口启动

    3、执行一下adb nodaemon server命令看看什么情况,这是一个比较有用的命令,一般情况下它会告诉我们哪里出问题了,adb nodaemon server,不幸的是仍然没有提示任何错误

    4、检查环境变量配置,没有错误

    5、基本排除adb本身的错误,开始定位CreateProcess failure, error 2 这个错误,查到了错误代码:

    windows error code 2 means: 2 The system cannot find the file specified. ERROR_FILE_NOT_FOUND
    and from the source code this is after a call to CreateProcess() and the file name is given by GetModuleFileName()

    已经查证过不是环境配置的问题,所以定位为系统无法启动该文件

    6、进入C:WINDOWSSystem32目录,检查adb相关文件,都是正确的

    7、复制System32目录下的adb.exe文件到C:WINDOWSSysWOW64 ,再次执行adb devices命令,提示缺失AdbWinApi.dll文件,再将System32目录下的AdbWinApi.dll文件copy到C:WINDOWSSysWOW64,执行adb devices命令成功

  • 相关阅读:
    BeautifulSoup模块
    爬取校花网视频
    爬虫基本原理
    python学习笔记-50 使用SQLAlchemy
    python学习笔记-49 使用MySQL
    PTA天梯 L3-007 天梯地图
    VS2013 创建ASP.NET MVC 4.0 未指定的错误(异常来自HRESULT: 0x80004005(e_fail))
    动态规划--新手
    文件上传绕过
    C# → 数据库
  • 原文地址:https://www.cnblogs.com/laosun0204/p/9317801.html
Copyright © 2020-2023  润新知