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?

More than 1 year has passed since last update.

【Flutter学習 #1】環境構築 その1

Posted at

はじめに

この記事はFlutter初心者の筆者が学習のために書いている記事です。
間違っていたら温かくご指摘いただけるとありがたいです。

動作環境

  • PC:Macbook
  • CPU:Intel
  • OS:MacOS Ventura 13.3.1

Flutter SDKをインストール

Flutter公式サイトからインストーラーを使ってインストールするという手もありますが、今回はHomebrewを使ってインストールしていきます。

ターミナルで以下のコマンドを実行します。

brew install flutter

以下のコマンドを実行してバージョンが表示されれば完了です。

flutter --version

次に、以下のコマンドを実行してみます。

flutter doctor

すると、私の場合は以下のようなメッセージが返ってきました。
iOSとAndroidのセットアップが必要になります。
スクリーンショット 2023-05-10 22.34.48.png

iOSをセットアップ

  • Xcodeをインストール

私は既にインストール済みでしたので割愛しますが、Xcodeがインストールされていない場合はAppStoreからインストールしてください。

インストールが終わったら、flutter doctorでも出てきているように以下の2つのコマンドを実行します。

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
  • cocoapodsをインストール

ターミナルで以下のコマンドを実行します。

brew install cocoapods

Androidのセットアップ

  • Android Studioをインストール

Homebrewを使ってインストールしていきます。
ターミナルで以下のコマンドを実行します。

brew install android-studio
  • Android Studioの初期設定

Android Studioを立ち上げて初期設定を行なっていきます。

スクリーンショット 2023-05-10 23.22.48.png
→「Do not import setting」のままOK

スクリーンショット 2023-05-10 23.23.34.png
→どちらを選んでもOK

スクリーンショット 2023-05-10 23.24.16.png
→そのままNext

スクリーンショット 2023-05-10 23.25.04.png
→StandardのままNext

スクリーンショット 2023-05-10 23.25.33.png
→どちらかを選んでNext

スクリーンショット 2023-05-10 23.26.19.png
→そのままNext

スクリーンショット 2023-05-10 23.27.11.png
→Acceptを選択してFinish

これでコンポーネントのダウンロードが始まりますので、終わるまで待ってください。

スクリーンショット 2023-05-10 23.35.18.png
→Finishを押して終了

次に、Welcome to Android Studioという画面が出るのでSDK Managerを選択します。
スクリーンショット 2023-05-10 23.36.52.png

スクリーンショット 2023-05-10 23.40.04.png
→Android SDK Command-line Toolsにチェックを入れてOK

インストールが終わったらFinishを押して終了です。

  • Android Licenseに同意する

ターミナルで以下のコマンドを実行します。

flutter doctor --android-licenses

何回も同意を求められますが、全部「y」を入力して同意してください。

確認

最後に、再度以下のコマンドを実行して確認します。

flutter doctor

オールクリアです!
スクリーンショット 2023-05-10 23.48.52.png

これでFlutterのインストールは完了です。
長くなってしまったので、プロジェクトの作成以降は次回にしたいと思います。

最後に

急遽業務で使うことになったのでFlutterの勉強も始めてみたのですが、環境構築からなかなかめんどいですね。とはいえ、新しい技術を学ぶことはとても楽しいことなので、楽しみながらFlutterの学習記録の記事も上げていきたいと思います。

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?