Flutter doctorのエラーに関して

コマンド「flutter doctor」を叩くと、Flutterの環境構築において不足なものがわかります。
その時に発生したエラーに関して書いていきます。

  • cmdline-tools component is missing
  • Some Android licenses not accepted

cmdline-tools component is missing

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.3.1 21E258 darwin-x64, locale
    ja-JP)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.66.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

こちらに関しては、以下の手順で解決できました。
以下、Android Studio ver3.6.3で確認

  • Android Studio起動 -> Tools -> SDK Manager
  • System Setting -> Android SDK -> SDK Toolsタブを選択
  • Android SDL Command-line Toolsにチェックを入れて「Apply」

参照:
Flutter doctor cmdline-tools componentエラー対処

Some Android licenses not accepted.

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.3.1 21E258 darwin-x64, locale
    ja-JP)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
      --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.66.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

こちらは以下のコマンドでライセンス認証することで解決できました。

$ flutter doctor --android-licenses 

いくつか質問されるので、「y」を入力して、ライセンスを承認していきます。