下载 flutter-sdk 解压到工作目录下
├── FlutterSdk
│ └── flutter
│ ├── bin
│ ├── dev
│ ├── examples
│ └── packages
在zshrc文件中配置环境变量
# flutter
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH="/Users/lordgod/FlutterSdk/flutter/bin:$PATH"
检查
flutter doctor
iOS /macOS 支持
下载xcode,注意flutter和Xcode有对应关系,比如我的Xcode是12.5,那我就不能使用最新的flutter2.8.0,只能使用2.2.2
然后根据提示安装命令行工具即可。
android环境
brew install android-sdk
环境变量
code ~/.zshrc
添加
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export ANDROID_HOME=$ANDROID_SDK_ROOT
# 使配置生效
source ~/.zshrc
安装构建工具,平台工具等
sdkmanager --update
sdkmanager "platform-tools" "platforms;android-29" "build-tools;29.0.3"
# 关联一下
flutter config --android-sdk /usr/local/share/android-sdk
# 接受安卓许可证
flutter doctor --android-licenses
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/288851.html