Flutter Windows Desktop开发记录-在编译Windows平台时报错

在编译Windows平台时出现异常提示

Exception: Unable to find suitable Visual Studio toolchain. Please run `flutter doctor` for more details.

看起来我的Visual Studio出了什么问题
于是我按照提示在终端使用了 flutter doctor 命令’

也可以Shift+Ctrl+P执行Flutter:Run Flutter Doctor
在这里插入图片描述
执行完后它巴拉巴拉输出了一堆
在这里插入图片描述
看见这里说我的Visual Studio缺少了必要的开发组件

Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.3)
• Visual Studio at D:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.10.31424.327
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:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK

好,这下知道原因了,好嘛,咱这就去装

PS: Visual Studio版本最少要2019版

打开Visual Studio

如果没有下载的Visual Studio的小伙伴先 去下载

在这里插入图片描述

在这里插入图片描述
然后等待它下载完成

下载好了之后回到VS Code在终端执行一下flutter doctor
在这里插入图片描述
Yes,已经打勾了

然后运行一下项目
在这里插入图片描述

运行成功啦

猜你喜欢

转载自blog.csdn.net/qq_39457683/article/details/123494789
今日推荐