Mac环境搭建flutter并配置环境变量

Windows环境搭建flutter

https://blog.csdn.net/ytfunnysite/article/details/81070066

克隆项目

git clone https://github.com/flutter/flutter.git
配置变量,使用中国镜像

进入当前用户的home目录 输入
cd ~

创建.bash_profile 输入
touch .bash_profile

编辑.bash_profile文件
open -e .bash_profile

如果已存在 .bash_profile

编辑文件

vim ~/.bash_profile


配置镜像
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn


command + s保存文件
更新配置的环境变量(保存)
source .bash_profile

验证PATH
echo $PATH

.bash_profile文件配置ANDROID_HOME环境变量:

export PUB_HOSTED_URL=https://pub.flutter-io.cn

export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn 

export PATH=/Users/(apple自己flutter放置的位置)/flutter/bin:$PATH

//查看sdk方法就说了 想亲们都知道

export ANDROID_HOME="/Users/(自己androidsdk路径)/Library/Android/sdk" 

export PATH=${PATH}:${ANDROID_HOME}/tools 

export PATH=${PATH}:${ANDROID_HOME}/platform-tools

//这个如果需要也加上

export PATH=${PATH}:${ANDROID_HOME}/build-tools/29.0.3(这个是自己安装的sdk中build-tools选项的版本号)



查看当前flutter版本分支
flutter channel

切换flutter稳定版stable分支
flutter channel stable

查看和升级flutter版本
flutter --version
flutter upgrade
————————————————
版权声明:本文为CSDN博主「杨天福」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ytfunnysite/article/details/99189417

原文地址:https://www.cnblogs.com/sundaysme/p/12574157.html