今天集成了flutter,准备学习一下,所以写篇文章记录一下。
先下载android studio安装,再打开终端,运行如下命令
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
复制代码
到github上下载futter sdk,然后输入如下命令,注意路径
cd ~/development
unzip ~/Downloads/flutter-master.zip
复制代码
添加flutter相关工具到path中
export PATH=`pwd`/flutter/bin:$PATH
复制代码
运行以下命令查看是否需要安装其它依赖项来完成安装
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,到此结束!