PUB_HOSTED_URL https://pub.flutter-io.cn //国内用户需要设置
FLUTTER_STORAGE_BASE_URL https://storage.flutter-io.cn //国内用户需要设置
ANDROID_HOME android SDK的安卓目录
PATH 添加 C:\flutter\bin以及Android需要的2个tools目录
mac配置环境变量:
vim ~/.bash_profile
输入:
export PATH=$PATH:~/flutter/bin:/Users/mac/Library/Android/sdk/platform-tools:/Users/mac/Library/Android/sdk/tools
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
保存完毕之后运行命令:
source ~/.bash_profile
然后就可以运行flutter命令了:
flutter --version
flutter channel
flutter build apk
关于flutter 插件在IOS端报错:'Flutter/Flutter.h not found'的解决
解决方案:
1,卸载cocoapods
$sudo gem uninstall cocoapods【Mac 10.10之前】
$sudo gem uninstall -n/usr/local/bin cocoapods【Mac 10.11之后】
2,重装cocoapods
$sudo gem install cocoapods
3,进入你项目中的ios目录设置pod
$cd 你项目根目录/ios
4,设置pod
$pod update