【问题标题】:Error while compiling a Flutter application for Windows为 Windows 编译 Flutter 应用程序时出错
【发布时间】:2021-04-03 08:03:56
【问题描述】:

你好,希望你一切都好。 在为 Windows 平台编译 Flutter 应用程序时遇到问题。 事实上,当我通过按下 VScode(或任何与 Flutter 兼容的 IDE)的“运行”按钮启动我的 Flutter 应用程序时,我会出现以下错误:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6006: Arrêt de "cmd.exe" avec le code 1. [C:\Users\Acer Aspire\VSCodeProjects\atlas_workspace\build\windows\flutter\flutter_assemble.vcxproj]
Exception: Build process failed.

但奇怪的是,通过使用 Powershell 终端,在我的项目的根目录下,通过执行命令 flutter run -d Windows,应用程序编译并启动没有问题。

你能告诉我问题是什么吗?以及如何解决?谢谢

我的Windows版本:windows 10 version 20H2(操作系统版本19042.884)

flutter doctor 命令的输出:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.3, on Microsoft Windows [version 10.0.19042.844], locale fr-FR)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.6)
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Community Edition (version 2020.2)
[√] VS Code (version 1.52.1)
[√] Connected device (3 available)

• No issues found!

flutter --version 命令的输出:

Flutter 2.0.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 4d7946a68d (2 weeks ago) • 2021-03-18 17:24:33 -0700
Engine • revision 3459eb2436
Tools • Dart 2.12.2

P.S:我的操作系统上安装了 Visual Studio 2019 和 C++ 工具

【问题讨论】:

  • 请提供完整的错误信息!
  • 您显示的错误只是最后一行,指出cmd.exe 返回1,而不是成功构建所期望的零。该错误消息对任何诊断都没有用,因为它对于 any 失败的构建都是相同的。您应该提供列在该行之前的错误消息。
  • 这就是控制台向我展示的所有内容@pritamparab
  • @Delucis 你到底在输入什么?应该有一些详细的模式,以防万一。如前所述,特定的控制台输出完全没用。

标签: c++ windows powershell flutter flutter-windows


【解决方案1】:

已解决!我必须更改我的用户名,使其不能包含任何空格,问题已解决

所以C:\Users\Acer Aspire\VSCodeProjects\atlas_workspace\ 现在是C:\Users\AcerAspire\VSCodeProjects\atlas_workspace\

【讨论】:

    【解决方案2】:

    这似乎是一个已知错误,因为您的用户名中有空格Acer Aspire

    https://github.com/flutter/flutter/issues/73644

    https://github.com/flutter/flutter/issues/75611

    【讨论】:

    • 我检查了您发送给我的链接中提出的解决方案。也就是说,解决方案是我可以重命名我的文件夹?
    • 为什么当我直接在终端运行flutter run -d windows 时它可以工作?
    猜你喜欢
    • 2021-12-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-27
    • 1970-01-01
    • 2012-01-31
    • 1970-01-01
    • 1970-01-01
    • 2019-08-14
    相关资源
    最近更新 更多