无法在 flutter 中调试桌面
我正在尝试使用默认 Flutter 项目首次启动 Windows 应用程序,但它显示此错误,
Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
Can't load AOT data from {#project-path}\build\windows\runner\Debug\data\app.so; no such file.
Unable to start engine without AOT data.
Failed to create view controller.
Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
Error launching application on Windows.
Exited (sigterm)
这是我的 flutter doctor -v
结果:
[√] Flutter (Channel stable, 2.10.2, on Microsoft Windows [Version 10.0.19044.1526], locale en-IN)
• Flutter version 2.10.2 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 097d3313d8 (3 days ago), 2022-02-18 19:33:08 -0600
• Engine revision a83ed0e5e3
• Dart version 2.16.1
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\panth\AppData\Local\Android\sdk
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32210.238
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] VS Code (version 1.64.2)
• VS Code at C:\Users\panth\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.29.0
[√] VS Code, 64-bit edition (version 1.63.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.29.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1526]
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.102
• Edge (web) • edge • web-javascript • Microsoft Edge 98.0.1108.56
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
这是我已经尝试过的
- 复制粘贴 app.so 文件./build/windows 到 ./build/windows/runner/Debug/data 这是一个低效的解决方案,因为热重载不起作用。
- 将 Visual Studio 降级到 2019 我尝试将 Visual Studio 降级到 2019,然后从根目录中删除 windows 文件夹,然后运行
flutter clean
和flutter create .
。然后开始调试,发生了这个错误,
Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
Error launching application on Windows.
Exited (sigterm)
所以我卸载了 Visual Studio 并安装了 2022 版本。
- 也尝试了
flutter clean
没有效果。
对于这个错误我该怎么办?
I am trying to start Windows app for first time with default Flutter Project but it's showing this error,
Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
Can't load AOT data from {#project-path}\build\windows\runner\Debug\data\app.so; no such file.
Unable to start engine without AOT data.
Failed to create view controller.
Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
Error launching application on Windows.
Exited (sigterm)
here is my flutter doctor -v
result:
[√] Flutter (Channel stable, 2.10.2, on Microsoft Windows [Version 10.0.19044.1526], locale en-IN)
• Flutter version 2.10.2 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 097d3313d8 (3 days ago), 2022-02-18 19:33:08 -0600
• Engine revision a83ed0e5e3
• Dart version 2.16.1
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\panth\AppData\Local\Android\sdk
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32210.238
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] VS Code (version 1.64.2)
• VS Code at C:\Users\panth\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.29.0
[√] VS Code, 64-bit edition (version 1.63.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.29.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1526]
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.102
• Edge (web) • edge • web-javascript • Microsoft Edge 98.0.1108.56
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
Here is what i have already tried
- copy paste app.so file from ./build/windows to ./build/windows/runner/Debug/data
this is an inefficient solution, since hot reload doesn't work. - downgrade visual studio to 2019
I tried to downgrade visual studio to 2019, and then deleted windows folder form root directory, then ranflutter clean
andflutter create .
. then started debug and this error happened
Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
Error launching application on Windows.
Exited (sigterm)
so i uninstalled visual studio and installed 2022 version back.
- Also tried
flutter clean
had no effect.
What can I do for this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是 Visual Studio 2022 最新更新附带的 CMake 版本中的一个错误目前除了使用早期版本的 VS 之外没有好的解决方法,但您可以按照该问题进行更新。
This is a bug in the version of CMake shipped with the latest update to Visual Studio 2022. There is currently no good workaround other than using an earlier version of VS, but you can follow that issue for updates.
当你降级到Visual Studio 2019时,你是否简单地删除了Visual Studio 2022?
我发现当我简单删除Visual Studio 2022时,我遇到了同样的错误。我成功地从 Visual Studio 2019 中卸载并重新安装了“使用 C++ 进行桌面开发”,然后安装了
flutter clean
和flutter run -d windows
。When you downgraded to Visual Studio 2019, did you simply delete Visual Studio 2022?
I found that when I simply deleted Visual Studio 2022, I had your same error. I had success by uninstalling then reinstalling "Desktop development with C++" from my Visual Studio 2019, followed by
flutter clean
andflutter run -d windows
.我已经修复了这个 github 问题。flutter github 问题
I have fixed from this github issue.flutter github issue