今天集成了flutter,准备学习一下,所以写篇文章记录一下。
建议先下载android studio安装,再下载Xcode
到github上下载futter sdk,然后指定路径,注意路径(后续步骤会使用)
检查是否存在.bash_profile文件:
open ~/.bash_profile新建.bash_profile文件:
1、输入 vim .bash_profile
2、输入 i 进行编辑模式
3、然后把需要编辑的内容键入,编辑完之后直接按esc退出编辑模式(内容如下)
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/mac/Documents/development/flutter/bin:$PATH
4、输入:w进行文件的保存,:wq为保存并退出指令注意/Users/mac/Documents/development/flutter为我自己安装的flutter的路径,要更换为自己的路径
运行以下命令查看是否需要安装其它依赖项来完成安装
flutter doctor
结果悲催了,爆了如下几个错误:
没关系,一一解决
先解决第一个问题,Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
运行flutter doctor --android-licenses
然后一直按照提示输入y即可第二个问题,libimobiledevice and ideviceinstaller are not installed
安装 homebrew,中途会需要输入密码,安装完成后输入如下命令:
brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
第三个问题,ios-deploy not installed.
brew install ios-deploy
第四个问题,Brew can be used to install tools for iOS device development. Download brew at https://brew.sh/. 上面安装过homebrew,跳过即可。
第五个问题,Android Studio (version 3.4)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
如下图配置即可:
然后再次运行flutter doctor命令,如下图所示:
这里就要找原因了,你也可以按照图中To update with Brew, run的提示命令运行,我知道是我xcode没有更新的原因,更新一下就好了。
耐心等待更新xcode,再输入如下命令:
brew install --HEAD libimobiledevice
brew install ideviceinstaller然后输入flutter doctor命令就如下图所示:
ok,到此结束!