Flutter 安裝

使用系統(tǒng)Mac OS

已經(jīng)沒辦法給大家看問題了,我在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...的時候連接不到外網(wǎng),以至于失敗

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

在配置文件中添加
<string>socksParentProxy=localhost:1086</string>

其中1086這個端口號,自己去看

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

可以看到,現(xiàn)在我是香港的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
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A >here</A>.
</BODY></HTML>

~ ? 11:43:33
$ curl www.google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A >here</A>.
</BODY></HTML>

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了

最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

  • afinalAfinal是一個android的ioc,orm框架 https://github.com/yangf...
    passiontim閱讀 15,900評論 2 45
  • Spring Cloud為開發(fā)人員提供了快速構建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,711評論 19 139
  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 179,361評論 25 708
  • 第一天,從現(xiàn)在開始。
    人間四月天n閱讀 151評論 0 0
  • 1、早上起來洗漱吃飯,吃過飯自己看了會書,9點半開始寫作上了,寫作業(yè)的時候小動作還是不少,媽媽希望仁賀自控能力加強...
    zrh黃豆閱讀 178評論 0 0

友情鏈接更多精彩內(nèi)容