安装 Flutter(国内镜像加速)
1️⃣ 下载 Flutter SDK(清华镜像)
git clone https://mirrors.tuna.tsinghua.edu.cn/git/flutter-sdk.git -b stable ~/development/flutter
2️⃣ 配置环境变量
echo 'export PATH="$PATH:$HOME/development/flutter/bin"' >> ~/.zshrc
echo 'export PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub/' >> ~/.zshrc
echo 'export FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter' >> ~/.zshrc
source ~/.zshrc
# 1. 克隆 flutter (stable)
git clone https://github.com/flutter/flutter.git -b stable ~/.flutter
# 2. 添加 PATH
echo 'export PATH="$PATH:$HOME/.flutter/bin"' >> ~/.zshrc
source ~/.zshrc
# 3. 验证
flutter doctor
3️⃣ 验证安装是否成功
flutter doctor
如果一切正常,你会看到:
Flutter 3.x.x • channel stable • https://mirrors.tuna.tsinghua.edu.cn/git/flutter-sdk.git
问题:1
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/to/macos-android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
你的 Flutter 已经装好 ✅,只是现在还缺 Android SDK(也就是 Android 工具链)。
这是 Flutter 在 macOS 上开发 Android 应用的必需部分。
第一次打开 Android Studio 时
启动 Android Studio → 会提示安装几个组件,请务必勾选:
• ✅ Android SDK
• ✅ Android SDK Platform
• ✅ Android Virtual Device (AVD)
• ✅ Android SDK Command-line Tools
然后点击「Next」→「Finish」,等待下载完成。
问题:2
Error: It seems there is already an App at '/Applications/Android Studio.app'.
解决方法
进入菜单栏:
Android Studio → Settings(或 Preferences) → Appearance & Behavior → System Settings → Android SDK

image.png