0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Flutter開発環境構築メモ

Last updated at Posted at 2025-03-20

はじめに

Macbookでクロスプラットフォームのアプリケーションを作ってみたいと思い、
Flutterの環境を構築してみました。

実施環境

  Model Name: MacBook Air
  Model Identifier: Mac16,12
  System Version: macOS 15.3.2 (24D2082)
  Kernel Version: Darwin 24.3.0
  Chip: Apple M4

※Homebrew、Xcodeはすでにインストール済み。

やったこと

  1. fvmのインストール
  2. Flutterのインストール
  3. 関連ソフトウェアのインストール

1. fvmのインストール

fvm(Flutter Version Management)はFlutterのバージョンを複数インストールして、切り替えて使用できるようにするためのものです。

# install fvm

brew tap leoafarias/fvm
brew install fvm

2. Flutterのインストール

fvmを使用してFlutterをインストールします。
※ fvmを使用している場合、flutterコマンドのPrefixにfvmが必要になります。

# install flutter
fvm install 3.29.2 --setup
fvm install 3.27.4 --setup    # 試しにふたつめのバージョンも入れてみました

# select global flutter version
fvm global 3.29.4

# confirm installation
fvm list                  
Cache directory:  /Users/cremarch/fvm/versions
Directory Size: 1.52 GB

┌─────────┬─────────┬─────────────────┬──────────────┬──────────────┬────────┬───────┐
│ Version │ Channel │ Flutter Version │ Dart Version │ Release Date │ Global │ Local │
├─────────┼─────────┼─────────────────┼──────────────┼──────────────┼────────┼───────┤
│ 3.29.2  │ stable  │ 3.29.2          │ 3.7.2        │ Mar 13, 2025 │ ●      │       │
├─────────┼─────────┼─────────────────┼──────────────┼──────────────┼────────┼───────┤
│ 3.27.4  │ stable  │ 3.27.4          │ 3.6.2        │ Feb 5, 2025  │        │       │
└─────────┴─────────┴─────────────────┴──────────────┴──────────────┴────────┴───────┘

fvm flutter --version
Flutter 3.29.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c236373904 (6 days ago) • 2025-03-13 16:17:06 -0400
Engine • revision 18b71d647a
Tools • Dart 3.7.2 • DevTools 2.42.3

fvm flutter doctor
Downloading Material fonts...                                      346ms
Downloading Gradle Wrapper...                                       17ms
Downloading package sky_engine...                                  335ms
Downloading package flutter_gpu...                                 131ms
Downloading flutter_patched_sdk tools...                           472ms
Downloading flutter_patched_sdk_product tools...                   465ms
Downloading darwin-arm64 tools...                                   4.2s
Downloading libimobiledevice...                                     26ms
Downloading usbmuxd...                                             225ms
Downloading libplist...                                            212ms
Downloading openssl...                                             471ms
Downloading ios-deploy...                                          148ms
Downloading darwin-arm64/font-subset tools...                      243ms
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.2, on macOS 15.3.2 24D2082 darwin-arm64, locale en-JP)
[✗] 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.

[!] Xcode - develop for iOS and macOS (Xcode 16.2)
    ✗ CocoaPods not installed.
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.98.2)
[✓] VS Code (version 1.99.0-insider)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 3 categories.

いくつかチェックに失敗しているので、解消していきます。

3. 関連ソフトウェアのインストール

  • cocoapods
brew install cocoapods
# install cocoapods
  • Android Studio
# install android studio
brew install --cask android-studio
  • Android toolchain
    Android toolchainはAndroid Studioからインストールしました。

More ActionsからSDK Managerを選択
install_android_toolchain_0001.png

SDK ToolsタブからAndroid SDK Command-line Tools (latest)を選択しOKボタンを押下
install_android_toolchain_0002.png

確認画面が表示されるのでOKを押下
install_android_toolchain_0003.png

インストーラが起動して処理が行われるので、完了したらFinishを押下
install_android_toolchain_0004.png

  • 再度確認
fvm flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.2, on macOS 15.3.2 24D2082 darwin-arm64, locale en-JP)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.98.2)
[✓] VS Code (version 1.99.0-insider)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.

案内に従い、flutter doctor --android-licensesを実行する

fvm flutter doctor --android-licenses
/Users/cremarch/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager: line 173: test: : integer expression expected
[=======================================] 100% Computing updates...             
4 of 6 SDK package licenses not accepted.
Review licenses that have not been accepted (y/N)? y

1/4: License android-googletv-license:
---------------------------------------
Terms and Conditions

This is the Google TV Add-on for the Android Software Development Kit License Agreement.

1. Introduction

1.1 The Google TV Add-on for...
.
.  
.
or grants rights that supersede, the terms of any applicable Open Source software license agreement.
---------------------------------------
Accept? (y/N): y
All SDK package licenses accepted
  • 再々度確認…
fvm flutter doctor                   
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.2, on macOS 15.3.2 24D2082 darwin-arm64, locale en-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.98.2)
[✓] VS Code (version 1.99.0-insider)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

• No issues found! <- Complete!!

ひとまず今回の環境構築はここまでとします。

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?