1.安装Flutter SDK
//1.终端中输入以下指令克隆项目
git clone -b beta https://github.com/flutter/flutter.git
//2. 导出到Flutter保存路径
export PATH=`pwd`/flutter/bin:$PATH
下载有可能有问题,我们通过镜像来解决。
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
git clone -b dev https://github.com/flutter/flutter.git
export PATH="$PWD/flutter/bin:$PATH"
cd ./flutter
flutter doctor
flutter doctor 检测环境执行结果如下
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.5 17F77, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[!] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
brew install --HEAD libimobiledevice
brew install ideviceinstaller
[✓] Android Studio (version 3.1)
[!] IntelliJ IDEA Ultimate Edition (version 2018.1.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.24.1)
[✓] Connected devices (1 available)
1.第一个对勾是说我的Flutter安装没问题
2.第二个对勾是说我的安卓工具也OK
3.第三行是说iOS工具没安装好, 具体就是需要安装他提供的两个库 按照他的说法终端执行如下操作
brew install --HEAD libimobiledevice
brew install ideviceinstaller
完事之后再执行 flutter doctor, 这一项就会变成对勾
4.第四个对勾是说我的Android Studio中Flutter插件已经安装, 如果没有安装提示和第五个 [!] 内容提示一样
!] Android Studio IDEA Ultimate Edition (version 2018.1.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
解决方案就是打开Android Studio -> Preference > Plugins 在搜索框中搜索 Flutter, 本地没有, 就联网查找,搜索到Flutter, 点击安装即可 Dart环境他自动会安装好, IntelliJ 的操作是一模一样的这里不再赘述
5.第五个是 VS code 编辑器, 这个里面直接搜索插件Flutter安装即可
6.第六个是我链接的一台设备
3.全部搞定运行 flutter doctor 结果如下
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.5 17F77, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✓] Android Studio (version 3.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1.1)
[!] VS Code (version 1.24.1)
[✓] Connected devices (2 available)
接下来就可以开发了。
网友评论