安装
//克隆flutter的beta分支
git clone -b beta https://github.com/flutter/flutter.git
配置"环境变量"
open ~/.bash_profile 或者
vim ~/.bash_profile
//如下配置即可
export FLUTTER_HOME=/Users/nnianhou/flutter
export PATH=$PATH:$FLUTTER_HOME/bin:
安装Flutter
flutter doctor
按照提示进行修复问题
安装或修改需要的地方,直到 flutter doctor 没有错误提示为止。
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
需要运行:
flutter doctor --android-licenses
这里界面会要求输入Y/N,一路输入Y就行了。
[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
✗ libimobiledevice and ideviceinstaller are not installed. To install with Brew, run:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
一步一步执行完就行了
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
打开android studio, 打开plugin
输入flutter搜索,然后进行安装
点击install,顺利的话安装完毕之后重启android studio
再次运行,如图环境OK
flutter doctor 检查失败原因
flutter doctor 检测失败的原因会有很多,例如以下
没有安装 Android Studio。
Android Studio 配置有问题。
Android Studio 没有安装Flutter插件。
没有安装Xcode,或Xcode版本过低。
没有安装CocoaPods
没有安装 libimobiledevice
没有安装 ideviceinstaller
没有安装 ios-deploy
一步一步按照提示进行修复问题
安装或修改需要的地方,直到 flutter doctor 没有错误提示为止。