flutter: 基本环境搭建

基本环境搭建
更新于: 2024-05-31 20:06:29

安装

  • Android Studio
  • Xcode(直接在AppStore中下载)

配置部分已经在 @jswork/ushell-module-flutter 这个包中处理了。

android studio 是必须的

# 下载
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.13.6-stable.zip ~/github/software/
# 解压
unzip flutter_macos_3.13.6-stable.zip
# 添加环境变量
export PATH="$PATH:$HOME/github/software/flutter/bin";
# 测试安装情况
flutter doctor
# 开发android agree licenses
flutter doctor --android-licenses

报错

Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to
resolve this.

I have just hit the same issue - my resolution was a little simpler:

Just like you, I have Android Studio installed, the key is to install Android SDK Command-line Tools, steps being:

  1. Open Android Studio
  2. Tools Menu, SDK Manager
  3. In the window that comes up there are inner panels, choose SDK Tools panel
  4. Tick Android SDK Command-line Tools
  5. Choose Apply button near the bottom of the window
安装 sdk command line tools

android 环境

由于暂时不会去开发 ios 相关的东西,所以,到这里已经算配置成功了。

ios环境

同意 xcode的相关协议: sudo xcodebuild -license

一些版本比较低的 Mac 可以放弃,基本无法运行 xcode,所以,这一项是无法正常运行的。