先在终端中通过以下命令启动模拟器:
emulator -avd
在Android Studio中选择菜单栏中的“Run” -> “Edit Configurations...”
点击左侧的“Android App”,然后在右侧的“General”选项卡中将“Target”设置为“Show chooser dialog”。
运行你的应用程序,应该会弹出一个对话框,询问你要使用哪个设备或模拟器。选择你想要使用的设备或模拟器,然后点击“OK”按钮即可启动应用程序。
示例代码:
在终端中使用以下命令启动模拟器:
emulator -avd Nexus_5X_API_28
然后在“Edit Configurations”中将“Target”设置为“Show chooser dialog”:
然后运行您的应用程序,会弹出一个对话框,询问您要使用哪个设备或模拟器。选择您想要使用的设备或模拟器,然后点击“OK”按钮: