Flutter 安装

使用系统Mac OS

已经没办法给大家看问题了,我在github上提了问题.

github issue

使用命令 command

`flutter doctor`

异常:
exception

SocketException: SocketException: Connection failed (OS Error: No route to host, errno = 65), address = android.googlesource.com, port = 443

总的来说就是下载 Downloading Gradle Wrapper...的时候连接不到外网,以至于失败

github上的这位小哥提醒了我@lishuhao

@eseidelGoogleit's reachable via https from Chrome
Maybe his chrome use proxy but terminal not use proxy.

我确实开了ss,但是终端确实连接不到代理的,不走代理,那当然无解

解决:

1.Mac下使用Homebrew安装

brew install polipo

2.修改配置

ln -sfv /usr/local/opt/polipo/*.plist ~/Library/LaunchAgents
image.png
vim /usr/local/opt/polipo/homebrew.mxcl.polipo.plist
image.png

在配置文件中添加
socksParentProxy=localhost:1086

其中1086这个端口号,自己去看

Flutter 安装_第1张图片
image.png

3.启动

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.polipo.plist

4.使用

$ http_proxy=http://localhost:8123 curl ip.gs
Current IP / 当前 IP: 47.90.88.133
ISP / 运营商:  ALIYUN
City / 城市:  Hong Kong
Country / 国家: China
IP.GS is now IP.SB, please visit https://ip.sb/ for more IP information, ip.gs will only use for curl purpose. / IP.GS 已更新至 IP.SB 请访问 https://ip.sb/ 获取更多信息, ip.gs 域名仅作 curl 使用
Please join Telegram group https://t.me/sbfans if you have any issues. / 如有问题,请加入 Telegram 群 https://t.me/sbfans

可以看到,现在我是香港的IP了,http_proxy=http://localhost:8123这个是提供默认的,至于怎么修改我没有看,也不知道

把代理设置为全局的

~ ⌚ 11:42:51
$ export http_proxy=http://localhost:8123

~ ⌚ 11:43:02
$ export https_proxy=http://localhost:8123

~ ⌚ 11:43:09
$ curl https://www.google.com

302 Moved

302 Moved

The document has moved here. ~ ⌚ 11:43:33 $ curl www.google.com 302 Moved

302 Moved

The document has moved here.

5.End

见证奇迹的时刻到了

~/develop/flutter on  alpha! ⌚ 11:44:11
$ flutter doctor
Downloading Gradle Wrapper...                         1.3s
[✓] Flutter (on Mac OS X 10.12.6 16G29, locale zh-Hans-CN, channel alpha)
    • Flutter at /Users/phyooos/develop/flutter
    • Framework revision b156a0f054 (9 days ago), 2017-08-11 22:01:40 -0700
    • Engine revision fef7d827d6
    • Tools Dart version 1.25.0-dev.9.0

[✓] Android toolchain - develop for Android devices (Android SDK 26.0.1)
    • Android SDK at /Users/phyooos/Library/Android/sdk
    • Platform android-26, build-tools 26.0.1
    • ANDROID_HOME = /Users/phyooos/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[-] iOS toolchain - develop for iOS devices
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    ✗ libimobiledevice and ideviceinstaller are not installed or require updating. To update, run:
        brew uninstall --ignore-dependencies libimobiledevice
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To install:
        brew install cocoapods
        pod setup

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.1.3)
    • Flutter plugin version 16.0
    • Dart plugin version 171.4424.63

[✓] Connected devices
    • None

我的Flutter就ok了

你可能感兴趣的:(Flutter 安装)