微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何将 Android 模拟器添加到 VS 代码中?

如何解决如何将 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 模拟器添加到 chrome 和 edge 浏览器旁边的 Flutter run 命令列表中?

解决方法

你应该:

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

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

,

+---+------------+-------------------------------------+ |ID |Activ_date | Do_skill | +---+------------+-------------------------------------+ | 1 | 2020-10-01 | Accountant,Medical,Photograph | | 2 | 2020-11-01 | Medical,Photograph,Doctor,Freelancer| | 3 | 2020-12-01 | EO,Teach,Scientist | | 4 | 2021-01-01 | Engineering,Freelancer | +---+------------+-------------------------------------+ 命令显示“可用设备”。尚未启动的模拟器在启动后才“可用”。

如果您使用 VS Code,您可能会发现使用内置的设备管理和调试比使用终端更好。在右下角的状态栏中,它应该显示您的“活动设备”,如果您单击它,它将让您切换到另一个设备。即使没有启动,该列表也会显示模拟器,选择一个将自动启动它。

Device/Emulator list

,
  • 下载 Android SDK 并进行初始设置。

  • 重新启动 VSCode 并清理项目:

    flutter clean
    
  • 如果这没有帮助,请尝试更新许可证:

    flutter doctor --android-licenses
    

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。