Ubuntu21.04にFlutterの開発環境構築
(1)準備
Flutter SDKインストール
$ git clone https://github.com/flutter/flutter
$ sudo mv flutter /usr/local/
$ export PATH=$PATH:/usr/local/flutter/bin
(2)Android Stuidoインストール
https://developer.android.com/studio
$ wget https://dl.google.com/dl/android/studio/ide-zips/3.5.3.0/android-studio-ide-191.6010548-linux.tar.gz
$ sudo tar -xzvf android-studio-ide-191.6010548-linux.tar.gz -C /usr/local/
$ /usr/local/android-studio/bin/studio.sh でAndroid Studioをセットアップ
(3)ビルドで必要になるパッケージのインストール
$ sudo apt install clang curl pkg-config ninja-build cmake libgtk-3-dev libblkid-dev liblzma-dev unzip
(4)Flutterのセットアップ
$ flutter config --enable-linux-desktop
(5)確認
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel master, v1.12.3-pre.49, on Linux, locale en_US.UTF-8)
[?] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[?] Linux toolchain - develop for Linux desktop
[!] Android Studio (version 3.5)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.40.1)
? Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Proxy Configuration
! NO_PROXY does not contain 127.0.0.1
[?] Connected device (1 available)
! Doctor found issues in 3 categories.
ーーーーーーーーーーーーーーーーーーーーーーーーーーー
サンプルの実行
(1)サンプルプロジェクトの作成
$ mkdir sample
$ cd sample
$ flutter create .
(2)実行
$ flutter run -d linux
もしくは
$ flutter build linux
$ build/linux/debug/bundle/sample
ーーーーーーーーーーーーーーーーーーーーーーーーーーー
デスクトップ向けプラグインの動作確認
(1)flutter-desktopーembedding取得
$ git clone https://github.com/google/flutter-desktop-embedding.git
(2)実行
$ cd flutter-desktop-embedding/testbed
$ flutter run -d linux
コメント