Android - 无法安装 *smartsocket* 侦听器

Android - could not install *smartsocket* listener

当我尝试 运行 我的 Android 应用程序时,我得到了这个异常:

Error while waiting for device: java.lang.RuntimeException: Unable to create Debug Bridge: Unable to start adb server: error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: An attempt was made to access a socket in a way forbidden by its access permissions. (10013) could not read ok from ADB Server * failed to start daemon * error: cannot connect to daemon 'C:\Users\XXX\AppData\Local\Android\Sdk\platform-tools\adb.exe,start-server' failed -- run manually if necessary

所以我尝试使用这些命令手动执行此操作:

adb kill-server

adb start-server

*daemon not running. starting it now on port 5037 * error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: An attempt was made to access a socket in a way forbidden by its access permissions. (10013) could not read ok from ADB Server

*failed to start daemon * error: cannot connect to daemon

我在我的任务管理器中寻找 adb 进程,但没有 运行ning。有任何想法吗?谢谢。

打开命令提示符并输入以下命令

netstat -ano |查找字符串:5037

这将显示收益 ID

TCP 127.0.0.1:5037 0.0.0.0:0 监听 832

832是收益id

现在运行命令

任务列表 | findstr processID(例如任务列表 | findstr 832)

它会显示类似 bash.exe

的进程名称

只需转到任务管理器并结束任务 bash.exe 并使用以下命令启动 adb

adb start-server

voillllaaaaaaa.......

如果您遇到这种情况不断发生并且终止并重新启动仍然不起作用,则可能是您的 adb 安装有问题。我不得不重新安装 adb 来解决这个问题:

  1. 重新启动以确保没有 adb 实例 运行
  2. 在 Android Studio 中启动 SDK 管理器:工具->Android->SDK 管理器
  3. Select SDK 工具选项卡
  4. Deselect Android SDK 平台-工具项
  5. 点击应用
  6. 检查屏幕日志以确保卸载成功并且 SDK/platform-tools 文件夹为空。

这应该会从您的 SDK 中完全删除 adb。

  1. 现在重新select Android SDK Platform-Tools 项
  2. 点击申请
  3. 检查安装成功的屏幕日志。

我怀疑在我的情况下,平台工具更新失败可能是因为它未能杀死 运行 adb.exe,并且只应用了部分更新,导致 adb 安装不稳定。

就我而言,罪魁祸首是 Visual Studio 2017 年。我在 Vinayak 的回答的帮助下发现了这一点。我刚刚关闭 Visual Studio 2017,然后 ADB 开始工作。

外部 终端 (CMD) 上重新启动 adb 服务器为我完成了这项工作:

Android-SDK/platform-tools/adb.exe kill-server
Android-SDK/platform-tools/adb.exe start-server

我自己解决了这个问题,方法是简单地关闭 shell 我一直 运行 adb 命令并开始一个新命令,灵感来自 Vinayak Mestri 的回答。

你只是让 "command prompt" 成为 运行 的管理员。 所以,你可以 运行 命令 "nox_adb.exe connect 127.0.0.1:62001" 图片如下: https://i.stack.imgur.com/fAmXz.png

感谢梅斯特里
使用 5037 端口列出进程 ID

netstat -ano | findstr :5037

TCP 127.0.0.1:39187 127.0.0.1:5037 已建立 5400 TCP 127.0.0.1:39188 127.0.0.1:5037 已建立 5400 TCP 127.0.0.1:39798 127.0.0.1:5037 已建立 5400 TCP 127.0.0.1:39902 127.0.0.1:5037 已建立 7296 TCP 127.0.0.1:40148 127.0.0.1:5037 已建立 5400 这里5400,7296是pid号

taskkill /pid pidnumber

然后\n

adb connect localhost:62001

adb 服务器版本 (41) 与此客户端 (36) 不匹配;杀... *守护进程成功启动* 连接到 localhost:62001

我通过将 ADB 添加到路径来修复它:

sudo ln -s ~/Android/Sdk/platform-tools/adb /bin/adb

然后终止 ADB 服务器 adb kill-server 并再次启动服务器 adb start-server

观察:我试图杀死 java,尝试使用 HTOP 和 Kill 找到它所在的端口 运行,除了重新启动一切之外,但这很痛苦