美文网首页
Flutter 环境配置(MAC)

Flutter 环境配置(MAC)

作者: 小青蛙的花 | 来源:发表于2020-09-09 14:23 被阅读0次

    直奔主题官方网站配置写的很详细了https://flutter.cn/docs/get-started/install
    这里说下我的问题:

    执行 flutter doctor 安装相关依赖报错

    product@productdeMacBook-Pro Flutter % flutter doctor
    Downloading Dart SDK from Flutter engine d1bc06f032f9d6c148ea6b96b48261d6f545004f...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:--  0:01:45 --:--:--     0
    curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to storage.googleapis.com:443 
    
    Failed to retrieve the Dart SDK from: https://storage.googleapis.com/flutter_infra/flutter/d1bc06f032f9d6c148ea6b96b48261d6f545004f/dart-sdk-darwin-x64.zip
    If you're located in China, please see this page:
      https://flutter.dev/community/china
    

    解决办法

    在 Linux 和 macOS Mojave 或 Mojave 之前的系统里,是默认使用 Bash 的,所以需要修改 .bashrc 文件。 macOS Catalina 操作系统默认使用 Z Shell,所以需要修改 .zshrc 文件
    macOS Catalina 操作系统默认使用 Z Shell,所以需要修改 .zshrc 文件

    vim ~/.bashrc
    添加如下代码,然后执行flutter doctor

    export PUB_HOSTED_URL=https://pub.flutter-io.cn
    export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
    export FLUTTER=/Users/Compass/Library/flutter/bin
    export PATH=$PATH:$FLUTTER
    

    输入下载进度

    Downloading Dart SDK from Flutter engine d1bc06f032f9d6c148ea6b96b48261d6f545004f...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
     92  247M   92  229M    0     0   171k      0  0:24:34  0:22:49  0:01:45  184k
    
    

    安装成功

    Building flutter tool...
    
      ╔════════════════════════════════════════════════════════════════════════════╗
      ║                 Welcome to Flutter! - https://flutter.dev                  ║
      ║                                                                            ║
      ║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
      ║ statistics and basic crash reports. This data is used to help improve      ║
      ║ Flutter tools over time.                                                   ║
      ║                                                                            ║
      ║ Flutter tool analytics are not sent on the very first run. To disable      ║
      ║ reporting, type 'flutter config --no-analytics'. To display the current    ║
      ║ setting, type 'flutter config'. If you opt out of analytics, an opt-out    ║
      ║ event will be sent, and then no further information will be sent by the    ║
      ║ Flutter tool.                                                              ║
      ║                                                                            ║
      ║ By downloading the Flutter SDK, you agree to the Google Terms of Service.  ║
      ║ Note: The Google Privacy Policy describes how data is handled in this      ║
      ║ service.                                                                   ║
      ║                                                                            ║
      ║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and  ║
      ║ crash reports to Google.                                                   ║
      ║                                                                            ║
      ║ Read about data we send with crash reports:                                ║
      ║ https://flutter.dev/docs/reference/crash-reporting                         ║
      ║                                                                            ║
      ║ See Google's privacy policy:                                               ║
      ║ https://policies.google.com/privacy                                        ║
      ╚════════════════════════════════════════════════════════════════════════════╝
    
    
    
    

    相关文章

      网友评论

          本文标题:Flutter 环境配置(MAC)

          本文链接:https://www.haomeiwen.com/subject/zfueektx.html