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

Windows环境搭建flutter

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

克隆项目

  • git clone https://github.com/flutter/flutter.git

配置变量,使用中国镜像

  1. 进入当前用户的home目录 输入
cd ~
  1. 创建.bash_profile 输入
touch .bash_profile
  1. 编辑.bash_profile文件
open -e .bash_profile
  1. 配置镜像
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
  1. command + s保存文件
  2. 更新配置的环境变量
source .bash_profile
  1. 验证PATH
echo $PATH
  1. .bash_profile文件配置ANDROID_HOME环境变量:
export ANDROID_HOME=/program/sdk
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/build-tools/28.0.3
  1. 查看当前flutter版本分支
flutter channel
  1. 切换flutter稳定版stable分支
flutter channel stable
  1. 查看和升级flutter版本
flutter --version
flutter upgrade

你可能感兴趣的:(Flutter)