Flutter: Visual Studio 缺少必要的组件。

创建于 2019-11-05  ·  9评论  ·  资料来源: flutter/flutter

重现步骤

  1. 在新的 Windows 机器上安装 Flutter
  2. 切换到主频道并升级到最新版本
  3. 安装 Visual Studio 2019 Community Edition,选择“Desktop development with C++”工作负载
  4. 启动新的 cmd 会话,以防任何环境变量已更改
  5. 运行flutter doctor并获得以下与 Visual Studio 相关的错误消息:

image

  1. 仔细检查 Visual Studio 安装程序设置,这似乎是正确的:

image

  1. 记录此错误

日志


[√] Flutter (Channel master, v1.10.15-pre.405, on Microsoft Windows [Version 10.0.18362.418], locale en-US)
    • Flutter version 1.10.15-pre.405 at c:\Users\csell\flutter
    • Framework revision 28b5cc3825 (4 hours ago), 2019-11-05 11:50:30 +0100
    • Engine revision 7b968ff95f
    • Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\csell\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[!] Visual Studio - develop for Windows (Visual Studio Community 2019 16.3.7)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.3.29424.173
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
        MSBuild
        MSVC v142 - VS 2019 C++ x64/x86 build tools
       - If there are multiple versions, install the latest one
        Windows 10 SDK (10.0.17763.0)

[!] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.39.2)
    • VS Code at C:\Users\csell\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.5.1

[√] Connected device (1 available)
    • Windows • Windows • windows-x64 • Microsoft Windows [Version 10.0.18362.418]

! Doctor found issues in 2 categories.
build desktop platform-windows flutter doctor tool

最有用的评论

您需要安装名为“Windows 10 SDK (10.0.17763.0)”的组件

所有9条评论

为 VS 2019 cmd 提示符运行 x64 Native Tools Command Prompt 可以在命令行上使用各种 MSVC 工具,例如 msbuild,但不会安抚flutter doctor

您的屏幕截图显示所需的 SDK 版本未选中,因此您缺少doctor列出的必需组件之一

显然,在 VS 2019 中,现在可以将版本设置为“10.0”而不是确切的版本,这在我最初研究这个时是不可能的。 我们可能需要 2019 年,以便我们可以切换到 2019 年,因为这一直是并将继续是一个痛点。

我该如何解决这个问题?

您需要安装名为“Windows 10 SDK (10.0.17763.0)”的组件

不幸的是,似乎没有“最新 SDK”的通用组件 ID,因此即使我们将其设置为 10.0 并且需要 VS 2019 执行vswhere查询也会非常混乱,并且需要为每个 Windows 更新工具SDK 发布。

那么错误是flutter doctor说要做两件事:

  1. 立即安装“最新的”Windows SDK,即“10.0.18362.0”。
  2. 安装“Windows 10 SDK (10.0.17763.0)”。

2 作品。 #1 没有。

关于安装最新版本的路线与构建工具有关,而不是 SDK。 从格式上应该可以清楚地看到,但缩进看起来像是搞砸了。

我们应该修复缩进,并在该行中再次明确提及构建工具,以便无论缩进如何都不会发生混淆。

结束,因为文本经过改进以帮助避免这种混淆。 #50487 跟踪试图完全消除对特定 SDK 版本的需求,这将避免这个常见问题。

此页面是否有帮助?
0 / 5 - 0 等级