使用系統(tǒng)Mac OS
已經(jīng)沒辦法給大家看問題了,我在github上提了問題.
使用命令 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了