Flutter 开发

安装

//克隆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
119178-7f26e3b039c65667.png
屏幕快照 2019-01-19 17.09.58.png

按照提示进行修复问题
安装或修改需要的地方,直到 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搜索,然后进行安装


119178-34af132318a706f6.png
屏幕快照 2019-01-19 17.30.01.png

点击install,顺利的话安装完毕之后重启android studio
再次运行,如图环境OK


119178-2b16f8596a95f5f8.png
屏幕快照 2019-01-19 17.31.19.png

flutter doctor 检查失败原因

flutter doctor 检测失败的原因会有很多,例如以下

没有安装 Android Studio。
Android Studio 配置有问题。
Android Studio 没有安装Flutter插件。
没有安装Xcode,或Xcode版本过低。
没有安装CocoaPods
没有安装 libimobiledevice
没有安装 ideviceinstaller
没有安装 ios-deploy

一步一步按照提示进行修复问题
安装或修改需要的地方,直到 flutter doctor 没有错误提示为止。

猜你喜欢

转载自blog.csdn.net/weixin_33795833/article/details/87116764