mac 上配置flutter

1、下载sdk
https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.0.5-stable.zip

mac 上有inter 版本和m1 版本。
2、下载解压到一个目录里面
3、配置flutter
在 .bash_profile里面添加

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

配置 Flutter 环境变量
在 .bash_profile里面添加

export FLUTTER=~/flutter
export PATH=PATH
然后在终端输入 source ~/.bash_profile 回车才会生效

遇到
cmdline-tools component is missing

解决
https://blog.csdn.net/hpp_1225/article/details/124345265

结果

shinaimengdeMacBook-Air:~ shinaimeng$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.5, on Mac OS X 10.13.6 17G14042 darwin-x64,
    locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[!] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS
      development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ! CocoaPods 1.5.3 out of date (1.11.0 is recommended).
        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 upgrade see
      https://guides.cocoapods.org/using/getting-started.html#installation for
      instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.3)
[✓] VS Code (version 1.63.2)
[✓] VS Code (version 1.63.2)
[✓] Connected device (2 available)

android studio 中配置路径

出现版本号才对
Flutter 3.0.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f1875d570e (2 周前) • 2022-07-13 11:24:16 -0700
Engine • revision e85ea0e79c
Tools • Dart 2.17.6 • DevTools 2.12.2
我的
/Users/x/development/flutter
dart-sdk
/Users/x/development/flutter/bin/cache/dart-sdk

地址很重要。

你可能感兴趣的:(mac 上配置flutter)