错误:“Adb 连接错误:现有连接被远程主机强制关闭”

发布于 2024-12-04 14:17:54 字数 284 浏览 2 评论 0 原文

当我尝试重置我的 adb 时,发生以下错误:

[2011-09-14 09:34:06 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host
[2011-09-14 09:34:07 - DeviceMonitor]Connection attempts: 1

我只是在制作一个简单的“hello world”程序。

When I tried to reset my adb the following error occurs:

[2011-09-14 09:34:06 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host
[2011-09-14 09:34:07 - DeviceMonitor]Connection attempts: 1

I am just making a simple "hello world" program.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

从﹋此江山别 2024-12-11 14:17:54

这个问题似乎没有确切的解决方案,因为每个人造成这个问题的原因都不相同。但是,如果您最近在 Android Studio Bumblebee (2021.1.1) 及更高版本中遇到此问题,则该问题可能是由于用于无线调试的 adb mDNS 导致的。

要解决此问题,请从此处禁用 mDNS 进行无线调试:

Android Studio >设置>构建、执行、部署>调试器>取消选中“启用 adb mDNS 进行无线调试”

更新(2022 年 3 月 19 日):

问题跟踪器,此问题已在 adb 版本 33.0.1 中修复

It seems this issue has no exact solution, because the cause of this issue is not same for everyone. However, if you have faced this issue recently in Android Studio Bumblebee (2021.1.1) and later, then the problem might have happened due to adb mDNS for wireless debugging.

To solve this issue, disable mDNS for wireless debugging from here:

Android Studio > Settings > Build, Execution, Deployment > Debugger > Untick "Enable adb mDNS for wireless debugging"

Update (19th March, 2022):

As mentioned in the issue tracker, this issue has been fixed in adb version 33.0.1

蓝眸 2024-12-11 14:17:54

嗯,并不是必须重新启动模拟器,您也可以从 eclipse 本身重置 adb。

1.)
进入DDMS,有一个重置adb选项,请参见下图。

在此处输入图像描述

2.) 您可以从命令提示符手动重新启动 adb

  run->cmd->your_android_sdk_path->platform-tools>

然后编写以下内容命令。

adb Kill-server - 强制终止服务器

adb start-server - 启动服务器

更新:

F:\android-sdk-windows latest\platform-tools>adb kill-server

F:\android-sdk-windows latest\platform-tools>adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *

Well, its not compulsory to restart the emulator you can also reset adb from eclipse itself.

1.)
Go to DDMS and there is a reset adb option, please see the image below.

enter image description here

2.) You can restart adb manually from command prompt

  run->cmd->your_android_sdk_path->platform-tools>

Then write the below commands.

adb kill-server - To kill the server forcefully

adb start-server - To start the server

UPDATED:

F:\android-sdk-windows latest\platform-tools>adb kill-server

F:\android-sdk-windows latest\platform-tools>adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
波浪屿的海角声 2024-12-11 14:17:54

更改为另一个 USB 端口对我有用。
我尝试重置 ADB,但问题仍然存在。

Change to another USB port works for me.
I tried reset ADB, but problem still there.

动听の歌 2024-12-11 14:17:54

看起来安装的驱动程序状态不佳。以下是我为使其正常工作所做的操作:

  1. 从设备管理器中删除设备。
  2. 重新扫描硬件更改。
  3. “Slate 21”将显示“未知驱动程序”状态。
  4. 单击“更新驱动程序”并选择 /extras/google/usb_driver
  5. 设备管理器将找到该驱动程序并警告您安装它。选择“是”。

这次设备已正确安装。

请注意,我不必修改 winusb.inf 文件或更新任何其他驱动程序。

希望这有帮助。

Looks like the installed driver was in bad state. Here is what I did to make it work:

  1. Delete the device from Device Manager.
  2. Rescan for hardware changes.
  3. "Slate 21" will show up with "Unknown driver" status.
  4. Click on "Update Driver" and select /extras/google/usb_driver
  5. Device Manager will find the driver and warn you about installing it. Select "Yes."

This time the device got installed properly.

Note that I didn't have to modify winusb.inf file or update any other driver.

Hope this helps.

习ぎ惯性依靠 2024-12-11 14:17:54

就我而言,重置 ADB 并没有什么区别。我还需要删除现有的相当旧的虚拟设备,并创建新的虚拟设备。

In my case, resetting ADB didn't make a difference. I also needed to delete my existing virtual devices, which were pretty old, and create new ones.

只涨不跌 2024-12-11 14:17:54

我知道我迟到了 4 年,但我的答案是为那些可能还没有弄清楚的人提供的。我使用的是三星 Galaxy S6,对我有用的是:

  1. 禁用 USB 调试

  2. 禁用开发者模式

  3. 从 USB 拔下设备电缆

  4. 重新启用开发者模式

  5. 重新启用 USB 调试

  6. 重新连接 将USB 电缆连接至您的设备

按照此顺序执行此操作非常重要,因为只有按此顺序完成后才能正常工作。

I know I'm 4 years late but my answer is for anyone who may not have figured it out. I'm using a Samsung Galaxy S6, what worked for me was:

  1. Disable USB debugging

  2. Disable Developer mode

  3. Unplug the device from the USB cable

  4. Re-enable Developer mode

  5. Re-enable USB debugging

  6. Reconnect the USB cable to your device

It is important you do it in this order as it didn't work until it was done in this order.

究竟谁懂我的在乎 2024-12-11 14:17:54

升级到 Android Studio Bumblebee 后我遇到了这个问题;导致adb服务器没有自动启动,需要手动启动。

即使我无法从 Android Studio 终端启动它,因为它在打字时会闪烁并失去焦点。

因此,我们使用 adb start-server 从操作系统 CLI/终端执行此操作。确保从 AndroidSDK\sdk\platform-tools 目录调用它。

如果 adb 已经启动,您可以尝试终止它,然后重新启动它:

adb kill-server
adb start-server

对于基于 Unix 的操作系统,在其前面加上 sudo 。

I faced that after upgrading to Android Studio Bumblebee; and the cause that the adb server doesn't get started automatically, and required to start it manually.

Even I couldn't start it from Android Studio terminal as it blinks and loses the focus while typing.

So, did that instead from the operating system CLI/terminal by using adb start-server. Make sure to call that from AndroidSDK\sdk\platform-tools directory.

If the adb already started, you can try to kill it, then restart it:

adb kill-server
adb start-server

Prepend that with sudo for Unix based Operating systems.

我们只是彼此的过ke 2024-12-11 14:17:54

就我而言,上面的答案都没有提到。如果您的设备使用 miniUsb 连接器,请确保您使用的电缆不只用于充电。我习惯了使用较新的 USB-C 设备进行开发,并且无法理解我的包中混入了仅充电的电缆,特别是因为没有明显的方法来区分。

在您卸载并经历驱动程序重新安装和 Android 菜单选项的噩梦之前。首先尝试使用不同的电缆。

In my case, which none of the answers above stated. If your device is using the miniUsb connector, make sure you are using a cable that is not charge-only. I became accustom to using developing with a newer Usb-C device and could not fathom a charge-only cable got mixed with my pack especially since there is no visible way to tell the difference.

Before you uninstall and go through a nightmare of driver reinstall and android menu options. Try a different cable first.

送舟行 2024-12-11 14:17:54

窗口->显示视图->设备(如果未找到->其他->< code>Device) 在最右边,有一个箭头,点击它,你会看到重置 adb,点击即可享受!这对我有用。

Window->Show View->device (if not found ->Other->Device) in right most side, there is arrow, click that, you will see reset adb, just click and enjoy!! It worked for me.

鱼忆七猫命九 2024-12-11 14:17:54

对我来说,这不是我的防病毒软件或防火墙。我以某种方式创建了一堆不必要的虚拟网络适配器,这些适配器干扰了 ADB。如果您遇到这种情况,请转到“设备管理器”->“设备管理器”。网络适​​配器,右键单击虚拟网络适配器,然后将其卸载。您始终可以轻松地重新创建它们。

这个答案对我有帮助:

如何删除 Windows 10 上 vagrant 创建的额外仅主机网络接口?

For me, it wasn't my antivirus or firewall. I had somehow created a bunch of unnecessary virtual network adapters that were interfering with ADB. If this is the case with you, go to Device Manager -> Network Adapter, right-click the virtual network adapters, and uninstall them. You can always easily recreate them.

This answer is what helped me:

How to remove extra host only network interfaces created by vagrant on windows 10?

十二 2024-12-11 14:17:54

最新版本的android studio对我来说打破了这个..重新安装2020.3.1.26后adb连接得很好,然后我尝试再次升级它只是为了看看..是的..再次失败。现在转到版本 2020.3.1.26 对我有用。

Latest version of android studio broke this for me.. adb connected just fine after reinstalling 2020.3.1.26, then I tried to upgrade it again just to see.. and yeah.. busted again. Going to version 2020.3.1.26 works for me now.

白昼 2024-12-11 14:17:54

对我有用的解决方案:Ubuntu 20.04、adb 33.0.1、Android Studio Bumblebee 2021.1.1:

  1. Android Studio >设置>构建、执行、部署>调试器:
    设置端口为 5038 的“使用现有手动管理服务器”。

在此处输入图像描述

  1. 关闭 Android Studio
  2. path-to-android-sdk/platform-tools/adb Kill-server
  3. path-to-android-sdk/platform-tools/adb start-server
  4. 启动 Android Studio

事件日志显示它无法到达 ADB 服务器,这很好。当您使用第 3 点和第 4 点中的命令运行时,adb 会在端口 5037 上启动。如果 Studio 连接到手动启动的 adb,它会终止它。这就是为什么必须在 Studio 设置中设置 5038(而不是 5037)。

输入图片此处描述

下次重新启动后,您只需执行 4. 和 5.

Solution that worked for me on: Ubuntu 20.04, adb 33.0.1, Android Studio Bumblebee 2021.1.1:

  1. Android Studio > Settings > Build, Execution, Deployment > Debugger:
    Set "Use existing manually managed server" with port 5038.

enter image description here

  1. Close Android Studio
  2. path-to-android-sdk/platform-tools/adb kill-server
  3. path-to-android-sdk/platform-tools/adb start-server
  4. Start Android Studio

Event Log shows that it cannot reach ADB server which is fine. When you run with command in point 3. and 4. adb starts on port 5037. If Studio connected to manually started adb, it'd kill it. That's why 5038 (instead 5037) has to be set in Studio settings.

enter image description here

After next reboot you should just execute 4. and 5.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文