Flutter环境配置

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

2.配置环境变量

将下载的Flutter安装包解压缩到指定目录下的文件夹(一般是在根目录下)
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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容