Flutter

Flutter 開発環境構築


はじめに


  • Flutter Webも登場してFlutter触ってみたくなった

  • まずはFlutter WebではなくAndroidでやってみる

  • ほんとうはAR CoreかAR KitやりたいんだけどFlutterでできるのかは分からない

  • Nest Hubのアプリ開発もやりたい

  • 取り敢えず公式のインストール手順どおりにやった記録




環境


  • Linux(Ubuntuデスクトップ)

  • Androidターゲット

  • Flutter、Androidともに未経験のおっさん


Flutterインストール

$ cd

$ curl -O https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.5.4-hotfix.2-stable.tar.xz
$ tar xf flutter_linux_v1.5.4-hotfix.2-stable.tar.xz
$ rm flutter_linux_v1.5.4-hotfix.2-stable.tar.xz


PATH追加

+# Flutter

+export PATH="$HOME/flutter/bin:$PATH"
+


必要な依存関係を解決する

$ flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, v1.5.4-hotfix.2, on Linux, locale en_US.UTF-8)
✗ Downloaded executables cannot execute on host.
See https://github.com/flutter/flutter/issues/6207 for more information
On Debian/Ubuntu/Mint: sudo apt-get install lib32stdc++6
On Fedora: dnf install libstdc++.i686
On Arch: pacman -S lib32-gcc-libs

[!] Android toolchain - develop for Android devices (Android SDK version 27.0.3)
✗ Flutter requires Android SDK 28 and the Android BuildTools 28.0.3
To update using sdkmanager, run:
"/home/hammer/Android/Sdk/tools/bin/sdkmanager" "platforms;android-28" "build-tools;28.0.3"
or visit https://flutter.dev/setup/#android-setup for detailed instructions.
✗ Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.0)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Community Edition (version 2018.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.29.1)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available

! Doctor found issues in 6 categories.


対応した作業

# [!] Flutter

$ sudo apt-get install lib32stdc++6
# [!] Android toolchain
$ "/home/hammer/Android/Sdk/tools/bin/sdkmanager" "platforms;android-28" "build-tools;28.0.3"
# [!] Android Studio (version 3.0)
# GUIでAndroid Studioの新しいやつ (version 3.4)をインストール
# GUIでAndroid StudioにFlutterとDartプラグインをインストールしてAndroid Studioを再起動

IDEはAndroid Studioでいいかな?と思ってInntelliJとVS Codeの部分は対応しなかった

deviceは持ってなかったのでPixel 3aを発注した


プロジェクト作成


  • Android StudioでNew Flutter Project

  • Flutter applicationを選択してプロジェクト作成


起動確認


  • Android Studioのツールバーからrunアイコンをクリック

  • エミュレータでアプリ起動が確認できたらOK