Mac Flutter配置环境

官方配置文档

一、下载

1、下载Flutter,在命令行:git clone -b beta https://github.com/flutter/flutter.git

或者可以手动下载Flutter,并放入想放的文件位置,如果是从GitHub自己下载的Flutter,可能会没有.git文件,需要手动创建:git init


二、配置文件.bash_profile

open ~/.bash_profile,如没有创建:touch .bash_profile

添加如下:

export PUB_HOSTED_URL=https://pub.flutter-io.cn

export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

export PATH=[你的flutter文件路径]/bin:$PATH


三、执行flutter doctor

报错1

fatal: invalid gitfile format: /Users/mac1/flutter-2.5.1/.git

Downloading Dart SDK from Flutter engine b3af521a050e6ef076778bcaf16e27b2521df8f8...

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100   353  100   353    0     0   2468      0 --:--:-- --:--:-- --:--:--  2468

[/Users/mac1/flutter/bin/cache/dart-sdk-darwin-x64.zip]

  End-of-central-directory signature not found.  Either this file is not

  a zipfile, or it constitutes one disk of a multi-part archive.  In the

  latter case the central directory and zipfile comment will be found on

  the last disk(s) of this archive.

unzip:  cannot find zipfile directory in one of /Users/mac1/flutter-2.5.1/bin/cache/dart-sdk-darwin-x64.zip or

        /Users/mac1/flutter/bin/cache/dart-sdk-darwin-x64.zip.zip, and cannot find /Users/mac1/flutter-2.5.1/bin/cache/dart-sdk-darwin-x64.zip.ZIP, period.

It appears that the downloaded file is corrupt; please try again.

If this problem persists, please report the problem at:

https://github.com/flutter/flutter/issues/new?template=ACTIVATION.md

解决1:

export PUB_HOSTED_URL=https://pub.flutter-io.cn

export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn


报错2:

Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

解决2:

执行flutter doctor --android-licenses ,一直按y

你可能感兴趣的:(Mac Flutter配置环境)