1.解决网络问题
环境搭载过程中会下载很多资源文件,资源更新不到时就很容易报错。Flutter官方为中国开发者搭建了临时镜像,大家可以将以下环境变量加载到用户环境变量中:
PUB_HOSTED_URL=https://pub.flutter-io.cn
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
我起初是用电脑属性/高级系统设置/环境变量/添加用户环境变量,不知是何原因一直添加不了(如果有知道的网友欢迎告诉我)
后来我选择了使用注册表修改方法(解决参考Windows 环境变量完全指南)
win+R>regedit>计算机\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment>添加
2.Git安装
此步骤参考Git 详细安装教程
3.安装FlutterSDK
官网安装可用安装包,将安装包解压到你的指定路径(有网友说不要将安装包解压到高权限路径里如C:\Program Files\。具体缘由我还不知道欢迎网友指教)
在Flutter安装目录的Flutter文件下找到fluttter_console.bat,双击运行并启动flutter命令行。
4.添加环境变量
Fluttter文件下的bin路径添加到Path中
5.flutter doctor 检查环境
[!] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
X cmdline-tools component is missing.
Try installing or updating Android Studio.
Alternatively, download the tools from https://developer.android.com/studio#command-line-tools-only and make sure
to set the ANDROID_HOME environment variable.
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/to/windows-android-setup for more details.
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2026 18.0.2)
[√] Connected device (3 available)
[√] Network resources
! Doctor found issues in 1 category.
运行后显示如上代码
解决打开 Android Studio,依次进入 File > Settings > Appearance & Behavior > System Settings > Android SDK 下载cmdline-tools;latest