参考如下文章进行环境搭建
参考:
简书 futter 环境配置
zsh 和bash环境变量 (zsh: command not found: flutter)
zsh的环境变量是 .zshrc 文件
bash的环境变量是 .bash.profile文件
1.下载flutter打开压缩包 运行 bin flutter文件
2. 打开终端执行命令 open ~/.bash_profile 打开配置文件 没有就使用 vim ~/.bash_profile创建一个
3.#Flutter 镜像配置
$ export PUB_HOSTED_URL=https://pub.flutter-io.cn
$ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
IOS环境配置
#Flutter 配置
$ export FLUTTER=/opt/flutter/bin 官网下载flutter到本地后bin的地址(图一地址)
$ export PATH=$FLUTTER:$PATH
4.#安卓环境配置
export ANDROID_HOME=~/Library/Android/sdk 下载的Android Studio的SDK路径 (可到Android Studio configure-project Default - Project Structure里查找)
#安卓模拟器路径
export PATH=${PATH}:${ANDROID_HOME}/emulator
#安卓tools路径
export PATH=${PATH}:${ANDROID_HOME}/tools
#安卓 平台工具
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
5.$ source ~/.bash_profile 更新
6.检查 $ flutter doctor
问题一
! Doctor found issues in 2 categories.
wlddeMacBook-Pro:~ wld$ brew update
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!
解决方案生成 ssh id_rsa.pub文件将内容导入到GitHub账号就可以了
参考自:生成ssh
问题二
执行 brew update命令
根据提示执行 brew upgrade ios-deploy命令等他更新完成就OK了
希望对碰到同样问题的小伙伴有帮助
网友评论