flutter - 无法使用 VScode 和 Android Studio Emulator 启动我的 flutter 应用程序

标签 flutter

我无法启动我的 flutter 应用程序,这是我在尝试使用 debbug 运行但没有 Debug模式时收到的消息:

您的启动配置引用了一个不存在的程序。如果启动时遇到问题,请检查“.vscode/launch.json”文件中的“程序”字段。

默认情况下我的 .json 文件:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Dart",
      "program": "lib/main.dart",
      "request": "launch",
      "type": "dart"
    }
  ]
 

我运行 flutter doctor:

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.6)
[√] VS Code (version 1.46.1)
[√] Connected device (1 available)

! Doctor found issues in 1 category.

并接受所有许可。

谢谢。

最佳答案

考虑这两个:


1. 确保您打开了项目的根目录,而不是更高的文件夹。这样 .vscode 文件夹将在与 lib 文件夹相同的级别上创建。

Screen of vscode


2. 检查 lib/main.dart 是否存在。如果您的 main 函数不同,请编辑 launch.json 文件并更改程序。

Screen of vscode


关于flutter - 无法使用 VScode 和 Android Studio Emulator 启动我的 flutter 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62700459/

相关文章:

flutter - 嵌套的 StreamBuilder 是好的模式吗?

flutter - 在 Dart (Flutter) 中将两个 "yield"并排放置,只有第二个被执行

firebase - 有什么办法可以在FieldValue.arrayUnion中添加FieldValue.increment()?

flutter - 当我设置超时持续时间时,没有互联网连接的未处理的套接字异常

flutter - 如何在flutter中设置周间隔日期,比如2019年1月3日、2019年1月10日、2019年1月17日3个月?

flutter - 哪个高效? Flutter StreamBuilder Widget 与 Stream.Listen() 和 setState()

android - 在 "flutter doctor"中显示关于 Android 工具链的错误

android - flutter : Overlaying the graphics on the barcode which is detected by firebase vision

android - Flutter with Android Studio 不显示设备列表

flutter - 在多次调用的选项卡 initstate() 之间切换