首页 > 解决方案 > ADB 无法连接到守护进程

问题描述

我知道这看起来像个骗子,但我已经阅读了这里所有提到这个 ADB 错误的帖子。我无法找到解决方案。这以前工作得很好,这对我来说是一个非常突然的问题。

这是命令提示符的输出:

C:\Users\myuser\AppData\Local\Android\Sdk\platform-tools>adb devices
   * daemon not running; starting now at tcp:5037
   adb: CreateFileW 'nul' failed: The system cannot find the file specified. (2)
   * failed to start daemon
   adb.exe: failed to check server version: cannot connect to daemon
   
   C:\Users\myuser\AppData\Local\Android\Sdk\platform-tools>adb kill-server
   cannot connect to daemon at tcp:5037: cannot connect to 127.0.0.1:5037: No connection could be made because the target machine actively refused it. (10061)
   
   C:\Users\myuser\AppData\Local\Android\Sdk\platform-tools>adb start-server
   * daemon not running; starting now at tcp:5037
   adb: CreateFileW 'nul' failed: The system cannot find the file specified. (2)
   * failed to start daemon
   error: cannot connect to daemon
   
   C:\Users\myuser\AppData\Local\Android\Sdk\platform-tools>adb reconnect
   * daemon not running; starting now at tcp:5037
   adb: CreateFileW 'nul' failed: The system cannot find the file specified. (2)
   * failed to start daemon
   error: cannot connect to daemon
   
   C:\Users\myuser\AppData\Local\Android\Sdk\platform-tools>adb reconnect device
   * daemon not running; starting now at tcp:5037
   adb: CreateFileW 'nul' failed: The system cannot find the file specified. (2)
   * failed to start daemon

系统:-Windows 10 家庭版-Android 版本 9(PAR-LX1M 华为)

我已经尝试过的事情:

- 检查端口是否被另一个进程使用

- 重新启动两个设备

-撤销和返还USB调试授权

-重新安装平台工具

- 仅删除 3 个 ADB 套件文件并重新安装它们

- 完全删除包含所有文件的 Android Studio 并重新安装。

-卸载HiSuite

-禁用防火墙和防病毒

- 从任务管理器结束 adb.exe 任务(该任务首先没有运行以结束它)

-运行 adb nodaemon server 这是输出

C:\Users\myuser\AppData\Local\Android\Sdk\platform-tools>adb nodaemon server
adb I 07-24 14:07:31 10484 47768 auth.cpp:437] adb_auth_init...
adb I 07-24 14:07:31 10484 11504 transport.cpp:282] [Phone Serial Number]: read thread spawning
adb I 07-24 14:07:31 10484 42584 transport.cpp:295] [Phone Serial Number]: write thread spawning
adb I 07-24 14:07:31 10484 47768 transport.cpp:1373] fetching keys for transport [Phone Serial Number]
adb I 07-24 14:07:31 10484 47768 auth.cpp:489] Calling send_auth_response
adb I 07-24 14:07:31 10484 47768 adb.cpp:114] [Phone Serial Number]: offline

然后它继续无休止地运行。

这个问题不是在 Android Studio 中开始的,因为我目前没有在这个项目中使用它。这个项目使用 Unity,它给了我一个空白错误,表明 SDK 没有正确安装。使用带有 Unity 的 Android SDK 工具进行检查或取消检查都不会提供相同的错误 Unity Error

这是 Unity 控制台中的错误

CommandWithNoStdoutInvokationFailure: Unable to start ADB server. Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details.
UnityEditor.Android.Command.RunWithShellExecute (System.String command, System.String args, System.String workingdir, System.String errorMsg) 
UnityEditor.Android.ADB.StartServer () 
UnityEditor.Android.ADB.Run (System.String[] command, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidDeploymentTargetsExtension.GetKnownTargets (UnityEditor.DeploymentTargets.IDeploymentTargetsMainThreadContext context, UnityEditor.ProgressHandler progressHandler)
UnityEditor.Android.PostProcessor.Tasks.CheckDevice.GetTargetDevices (UnityEditor.Android.ADB adb)
UnityEditor.Android.PostProcessor.Tasks.CheckDevice.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

任何帮助,将不胜感激。蒂亚!

更新:此问题在另一台 Android 设备上仍然存在。

更新 2:在前台运行 adb nodaemon 服务器,然后在 Unity 中构建似乎可以工作,尽管 adb 控制台显示“离线”。问题仍然存在,为什么会发生这种情况,我怎样才能让它像以前一样正常工作?

标签: androidadb

解决方案


推荐阅读