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

在配置文件中添加
<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

可以看到,现在我是香港的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 HREF="https://www.google.com.hk/?gfe_rd=cr&ei=5FaaWZDNOMLU8Af_nriwDw">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 HREF="http://www.google.com.hk/?gfe_rd=cr&ei=6laaWZqEO8_U8AeLlID4CA">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了

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,794评论 2 45
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,278评论 19 139
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 177,210评论 25 709
  • 第一天,从现在开始。
    人间四月天n阅读 1,216评论 0 0
  • 1、早上起来洗漱吃饭,吃过饭自己看了会书,9点半开始写作上了,写作业的时候小动作还是不少,妈妈希望仁贺自控能力加强...
    zrh黄豆阅读 1,319评论 0 0

友情链接更多精彩内容