1.下載FlutterSDK
https://flutter.io/setup-macos/
2.配置環(huán)境變量
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,)
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