首先,确保你的系统开启Hyper-V功能:
1. 打开控制面板 -> 卸载程序 -> 选择启动或关闭Windows功能 -> 找到并勾选Hyper-V -> 确定安装
下载Visual Studio Emulator for Android的安装包(约40MB),它不包含预装的安卓镜像,安装时会自动下载API 19的x86版本。你可以根据需求选择其他API版本。值得注意的是,这个模拟器独立于Visual Studio,Android Studio则通过adb连接它。
安装过程略过,但务必记得安装后重启系统。
重启后,打开Visual Studio Emulator for Android,你会在Hyper-V中看到创建的相应Android虚拟机,如下所示:
接下来,我们需要在Android Studio中设置模拟器的使用方式:
1. 在Android Studio的"Run" -> "Edit Configurations" -> "Defaults / Android Application" -> "General"选项卡中,确保勾选"Show chooser dialog"和"Use same device for future launches"。别忘了点击Apply和OK,以使设置生效。