1、下載Fullter SDK
? ? ?官方地址:?https://flutter.cn/docs/get-started/install/macos#update-your-path
2苇本、解壓
? ? ?cd /Users/reead/Downloads/Flutter
? ? ?unzip /Users/reead/Downloads/Flutter/flutter_macos_v1.9.1+hotfix.5-stable.zip?
3袜茧、配置環(huán)境變量
打開當(dāng)前目錄下的.bash_profile文件
? ? ?vi ~/.bash_profile
復(fù)制一下代碼并保存
? ? ?export PUB_HOSTED_URL=https://pub.flutter-io.cn
? ? ?export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
? ? ?export PATH=${PATH}:${PWD}/flutter/bin
增加一行
? ? ? export PATH=/你的flutter文件夾所在位置/flutter/bin:$PATH
保存全局變量文件
? ? ? source ~/.bash_profile
可以運(yùn)行flutter命令
? ? ??flutter -h
4笛厦、檢查依賴
? ? flutter doctor -v
根據(jù)提示依次執(zhí)行 :
flutter doctor --android-licenses?
過程中一直Y到底。
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo gem install cocoapods
在sudo gem install cocoapods的時候俺夕,會提示
Fetching: httpclient-2.8.3.gem (100%)
ERROR:? While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
用sudo gem install -n /usr/local/bin cocoapods替換上面的命令繼續(xù)執(zhí)行就可以了裳凸。
[?] Android Studio (version 3.5)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
這個只需要打開Android Studio->preferences->Plugins中,搜索Flutter install后劝贸,重啟Android studio.
再次運(yùn)行
flutter doctor
即可登舞!