Flutter 环境变量配置

1.首先下载flutter 版本,解压到本地,
https://docs.flutter.dev/development/tools/sdk/releases?tab=windows#windows
2.配置flutter环境变量,
(1)在系统变量Path中添加,D:\flutter\bin

截图(1).png

(2)在系统变量添加FLUTTER_STORAGE_BASE_URL,变量值为:https://storage.flutter-io.cn
如图:

截图.png

(3)在系统变量添加PUB_HOSTED_URL,变量值为:https://pub.flutter-io.cn

截图.png

FLUTTER_STORAGE_BASE_URL: https://storage.flutter-io.cn
PUB_HOSTED_URL: https://pub.flutter-io.cn

3.运行flutter doctor
安装flutter后报错,出现这个问题,是因为你的C盘 也就是系统盘找不到Android SDK
[✓] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.19042.804], locale zh-CN)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/setup/#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set
ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.
[!] Android Studio (not installed)
[✓] VS Code (version 1.34.0)
[✓] Connected device (1 available)

解决办法 :配置环境变量,在用户变量中添加 ANDROID_HOME或者ANDROID_SDK_ROOT 然后再后面填写你的SDK路径运行就行
如图所示


image.png

你可能感兴趣的:(Flutter 环境变量配置)