0
点赞
收藏
分享

微信扫一扫

macOS安装Flutter开发环境

西曲风 2022-01-27 阅读 85
fluttermacos

1 先安装Xcode和Android Studio

2 设置环境变量

vi ~/.zshrc
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

3 下载Flutter SDK

https://docs.flutter.dev/development/tools/sdk/releases

解压缩到指定目录比如

/Users/用户/program/flutter

4 修改环境变量

vi ~/.zshrc
export FLUTTER_HOME=/Users/用户/program/flutter 
export PATH=${PATH}:${FLUTTER_HOME}/bin
source ~/.zshrc

5 执行flutter doctor

flutter doctor
Running "flutter pub get" in flutter_tools...                      10.8s
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-x64, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    ✗ Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[!] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin
        usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.1)
[✓] VS Code (version 1.63.2)
[✓] Connected device (1 available)

! Doctor found issues in 2 categories.
qiangdeMacBook-Pro:~ qiang$ 

执行,不停按y

flutter doctor --android-licenses

安装cocoapods

sudo gem install cocoapods

6 开启关闭模块

flutter config --enable-web
flutter config --enable-macos-desktop
flutter config --enable-windows-desktop
flutter config --no-enable-web
flutter config --no-enable-macos-desktop
flutter config --no-enable-windows-desktop

7 Androids Studio 安装插件

plugins下搜索flutter安装

重启AS

8. Androids Studio 新建Flutter项目

举报

相关推荐

0 条评论