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
- 配置镜像
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 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
- 查看当前flutter版本分支
flutter channel
- 切换flutter稳定版stable分支
flutter channel stable
- 查看和升级flutter版本
flutter --version
flutter upgrade
使用压缩包
如果没有在线下载,而是使用的官方压缩包,可以通过.zshrc配置环境变量
cd ~
touch .zshrc
open -e .zshrc
打开.zshrc 后配置解压的flutter路径 export PATH="$PATH:/Library/flutter/bin"保存后刷新配置
source $HOME/.zshrc
echo $PATH //验证环境变量