Visual Studio Android 的模拟器经常与 ADB 分离

Visual Studio Emulator for Android is frequently detached from ADB

Visual Studio Emulator for Android works great with Android Studio. There is only one problem I am experiencing now: It is detached from ADB frequently. I can start the emulator and load an app to run without any problem. However, after a while, it is detached without any warning. Android Studio and Android Device Monitor 不再看到模拟器,而他们总是可以毫无问题地看到连接到开发机器的物理设备,所以我认为 ADB 工作正常。重新启动模拟器将恢复附件,但它会在一段时间后再次分离。重置 ADP 没有帮助。

Visual Studio Emulator for Android 是一个 运行 Hyper-V 虚拟机,它使用 虚构 电缆连接到您的主机。

既然是真机,把它看成实体设备是正常的。

我一直遇到完全相同的问题。这不是修复,而是解决方法;您可以使用命令行手动将 ADB 重新连接到模拟器:

adb connect <ip>:5555

(来自 Prem's answer 类似问题)

如果查看 ADB 日志,您可以找到 < ip > 的值。您可能会看到类似于

的内容

ExecutionException getting info for device 123.456.123.456:5555

或者您可以打开模拟器的 'Additional Tools' 并查看网络地址。