首页 > 解决方案 > 如何将 Android 模拟器添加到 VS 代码?

问题描述

当我使用flutter run命令时,它显示以下消息:

Multiple devices found:
Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.146
Edge (web)   • edge   • web-javascript • Microsoft Edge 86.0.622.51
[1]: Chrome (chrome)
[2]: Edge (edge)
Please choose one (To quit, press "q/Q"):

这也是 flutter emulators命令的结果:

3 available emulators:

Nexus_5x       • Nexus_5x       • Google • android
Pixel_2_API_29 • Pixel 2 API 29 • Google • android
pixel_xl       • pixel_xl       • Google • android

To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links below:
  https://developer.android.com/studio/run/managing-avds
  https://developer.android.com/studio/command-line/avdmanager

是否可以将 Android 模拟器添加到flutter runchrome 和 edge 浏览器旁边的命令列表中?

标签: fluttervisual-studio-codecommand-lineandroid-emulator

解决方案


你应该:

  • 检索可用模拟器的列表
flutter emulators
  • 启动模拟器
flutter emulators --launch Nexus_5x

然后,当您运行时,flutter run您应该会看到新的 android 模拟器。


推荐阅读