错误:“Adb 连接错误:现有连接被远程主机强制关闭”
当我尝试重置我的 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”程序。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
这个问题似乎没有确切的解决方案,因为每个人造成这个问题的原因都不相同。但是,如果您最近在 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
嗯,并不是必须重新启动模拟器,您也可以从 eclipse 本身重置 adb。
1.)
进入DDMS,有一个重置adb选项,请参见下图。
2.) 您可以从命令提示符手动重新启动 adb
然后编写以下内容命令。
adb Kill-server - 强制终止服务器
adb start-server - 启动服务器
更新:
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.
2.) You can restart adb manually from command prompt
Then write the below commands.
adb kill-server - To kill the server forcefully
adb start-server - To start the server
UPDATED:
更改为另一个 USB 端口对我有用。
我尝试重置 ADB,但问题仍然存在。
Change to another USB port works for me.
I tried reset ADB, but problem still there.
看起来安装的驱动程序状态不佳。以下是我为使其正常工作所做的操作:
这次设备已正确安装。
请注意,我不必修改 winusb.inf 文件或更新任何其他驱动程序。
希望这有帮助。
Looks like the installed driver was in bad state. Here is what I did to make it work:
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.
就我而言,重置 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.
我知道我迟到了 4 年,但我的答案是为那些可能还没有弄清楚的人提供的。我使用的是三星 Galaxy S6,对我有用的是:
禁用 USB 调试
禁用开发者模式
从 USB 拔下设备电缆
重新启用开发者模式
重新启用 USB 调试
重新连接 将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:
Disable USB debugging
Disable Developer mode
Unplug the device from the USB cable
Re-enable Developer mode
Re-enable USB debugging
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.
升级到 Android Studio Bumblebee 后我遇到了这个问题;导致
adb
服务器没有自动启动,需要手动启动。即使我无法从 Android Studio 终端启动它,因为它在打字时会闪烁并失去焦点。
因此,我们使用
adb start-server
从操作系统 CLI/终端执行此操作。确保从AndroidSDK\sdk\platform-tools
目录调用它。如果 adb 已经启动,您可以尝试终止它,然后重新启动它:
对于基于 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 fromAndroidSDK\sdk\platform-tools
directory.If the adb already started, you can try to kill it, then restart it:
Prepend that with
sudo
for Unix based Operating systems.就我而言,上面的答案都没有提到。如果您的设备使用 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.
窗口
->显示视图
->设备
(如果未找到->其他
->< 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.对我来说,这不是我的防病毒软件或防火墙。我以某种方式创建了一堆不必要的虚拟网络适配器,这些适配器干扰了 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?
最新版本的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.
对我有用的解决方案:Ubuntu 20.04、adb 33.0.1、Android Studio Bumblebee 2021.1.1:
设置端口为 5038 的“使用现有手动管理服务器”。
事件日志显示它无法到达 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:
Set "Use existing manually managed server" with port 5038.
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.
After next reboot you should just execute 4. and 5.