Flutter环境配置

1.下载FlutterSDK
https://flutter.io/setup-macos/

2.配置环境变量

将下载的Flutter安装包解压缩到指定目录下的文件夹(一般是在根目录下)
Flutter环境配置_第1张图片
A170D583-E569-4EEB-AB40-A95F11EDEF27.png

3.编辑 .bash_profile文件
①.打开 .bash_profile文件: open -e .bash_profile
②.添加字段:
git clone -b beta https://github.com/flutter/flutter.git
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=pwd/flutter/bin:$PATH
③.保存: source .bash_profile
(下载完后需要再打开一次.bash_profile,删除git clone -b beta https://github.com/flutter/flutter.git
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn,)

image.png

4.运行flutter doctor 查看是否需要安装其他依赖项
flutter doctor

例如: Android toolchain - develop for Android devices
• Android SDK at /Users/obiwan/Library/Android/sdk
✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ
• Try re-installing or updating your Android SDK,
visit https://flutter.io/setup/#android-setup for detailed instructions.
就是说明缺少AndroidSDK

WeChat42c67921aa87ef5242a318808e5ac6da.png

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