1.配置镜像打开bash_profile
//两种方式打开
vim ~/.bash_profile
open -n ~/.bash_profile //这种文本方式打开编辑
2.添加全局变量
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=[https://storage.flutter-io.cn](https://storage.flutter-io.cn/)
3.下载flutter SDK 文件目录是/Users/zmx/app/flutter
export PATH=/Users/zmx/app/flutter/bin:$PATH
4.遇到问题
(1) flutter项目中iOS调试真机是不能调试的,按照下面步骤一步步进行
安装到libimobiledevice 会出现错误
brew install --HEAD libimobiledevice
根据提示发现 libusbmuxd的版本太低导致的。执行下面的命令卸载重装一下就是最新版本了
brew unlink usbmuxd & brew install --HEAD usbmuxd
(2)遇到iOS模拟器无法启动
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.io/platform-plugins
To install:
brew install cocoapods
pod setup
// 解决方法 https://github.com/flutter/flutter/issues/14293
sudo gem install cocoapods -n /usr/local/bin
(3) 安装插件卡死问题:
Waiting for another flutter command to release the startup lock...
参考链接:https://github.com/flutter/flutter/issues/17422
解决步骤:
查了一下github的flutter issue 找到了解决方法,如下:
1、打开flutter的安装目录/bin/cache/
2、删除lockfile文件
3、重启AndroidStudio