安装环境

你好! 这是第一次使用 Flutter ,准备学习下。刚开始看Flutter中文版网站步骤,边百度学习参考Flutter 安装 (Mac环境)1

1. 打开终端。克隆项目

git clone -b beta https://github.com/flutter/flutter.git
Flutter之旅(零)

2. 导出到Flutter保存路径

export PATH=pwd/flutter/bin:$PATH
Flutter之旅(零)

3. 使用镜像(国内可翻墙情况)。(如果可以直接连国外这里是可行的。不行跳至4)

cd ./flutter
flutter doctor
Flutter之旅(零)

4. 使用镜像。由于在国内访问Flutter有时可能会受到限制,Flutter官方为中国开发者搭建了临时镜像,可以将如下环境变量加入到用户环境变量中:

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
flutter doctor

Flutter之旅(零)
Flutter之旅(零)

最后,好像是我本机上根据终端提示进行升级。

**更新出现错误

$ flutter doctor

MacBook-Pro-cql:flutter chenql$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.2.1, on Mac OS X 10.14.1 18B75, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    ✗ libimobiledevice and ideviceinstaller are not installed. To install with Brew, run:
        brew update
        brew install --HEAD usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
[!] Android Studio (version 3.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

出现**[!]XX** 然后根据后面提示,运行命令。如上所示的

其他语句执行都正常;到这句:
$brew install --HEAD libimobiledevice
执行到这句时一直提示错误

$ brew install --HEAD libimobiledevice
==> Cloning https://git.libimobiledevice.org/libimobiledevice.git
Cloning into ‘/Users/chenql/Library/Caches/Homebrew/libimobiledevice–git’…
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: An exception occurred within a child process:
DownloadError: Failed to download resource “libimobiledevice”
Failure while executing; git clone --branch master https://git.libimobiledevice.org/libimobiledevice.git /Users/chenql/Library/Caches/Homebrew/libimobiledevice--git exited with 128. Here’s the output:
Cloning into ‘/Users/chenql/Library/Caches/Homebrew/libimobiledevice–git’…
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

搜索很多文章,最后有篇文章Flutter开发环境搭建-踩坑指南提示,一直运行直到初始化成功。我还是坚持要咬牙运行了不下20几次(估计)。
Flutter之旅(零)


  1. https://blog.csdn.net/wangjunling888/article/details/80768285 ↩︎

相关文章: