1安装flutter
https://flutter.cn/docs/development/tools/sdk/releases?tab=macos 安装flutter的sdk
- 下载好放在你想要的目录,命令行 cd 在该目录下,解压 unzip。
3.命令行:open ~/.bash_profile或者open ~/.zshrc,打开并添加环境变量如下:(其中/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.运行Flutter工程,需要安装Xcode和Android studio,studio需要下载Flutter和Dart插件:
5输入flutter doctor
出现zsh: command not found: flutter 那直接刷新source ~/.bash_profile
6。输入flutter doctor安卓提示
Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
直接运行:flutter doctor --android-licenses 然后一路Y
7.运行iOS出现:could not find included file ‘Generated.xcconfig‘ in search paths (in target ‘Runner‘)
直接cd到iOS目录下 执行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