1安裝flutter
https://flutter.cn/docs/development/tools/sdk/releases?tab=macos 安裝flutter的sdk
- 下載好放在你想要的目錄,命令行 cd 在該目錄下吮廉,解壓 unzip闹获。
3.命令行:open ~/.bash_profile或者open ~/.zshrc,打開并添加環(huán)境變量如下:(其中/Users/Documents/flutterSDK/flutter為自己flutter的目錄)
export PATH="/Users/Documents/flutterSDK/flutter/bin:$PATH"
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
4.運(yùn)行Flutter工程叁巨,需要安裝Xcode和Android studio,studio需要下載Flutter和Dart插件:
5輸入flutter doctor
出現(xiàn)zsh: command not found: flutter 那直接刷新source ~/.bash_profile
6呐籽。輸入flutter doctor安卓提示
Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
直接運(yùn)行:flutter doctor --android-licenses 然后一路Y
7.運(yùn)行iOS出現(xiàn):could not find included file ‘Generated.xcconfig‘ in search paths (in target ‘Runner‘)
直接cd到iOS目錄下 執(zhí)行flutter build ios
例如:yanglijun@yanglijundeMacBook-Pro-1 flutter % cd /Users/yanglijun/Desktop/AndroidDome/Flutter01/flutter_app/ios
yanglijun@yanglijundeMacBook-Pro-1 ios % flutter build ios