一、下載
1、下載Flutter,在命令行:git clone -b beta?https://github.com/flutter/flutter.git
或者可以手動下載Flutter,并放入想放的文件位置,如果是從GitHub自己下載的Flutter,可能會沒有.git文件,需要手動創(chuàng)建:git init
二、配置文件.bash_profile
open ~/.bash_profile,如沒有創(chuàng)建: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
三、執(zhí)行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:
執(zhí)行flutter doctor --android-licenses ,一直按y