寝ても覚めてもこんぴうた

プログラム書いたり、ネットワーク設計したり、サーバ構築したり、車いじったり、ゲームしたり。そんなひとにわたしはなりたい。 投げ銭は kyash_id : chidakiyo マデ

#Flutter やってみる : (1) Flutter開発環境の構築

f:id:chidakiyo:20190722145735j:plain

Flutterのインストール

https://flutter.dev/docs/get-started/install/macos

zipをダウンロードして解凍してPATH通すだけ。

flutter doctor コマンドでチェックする

>> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.7.8+hotfix.3, on Mac OS X 10.14.5 18F132, locale ja-JP)[f:id:chidakiyo:20190722145735j:plain]
[✗] 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/setup/#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.

[!] Xcode - develop for iOS and macOS (Xcode 10.2.1)
    ! CocoaPods out of date (1.6.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your
        plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade:
        brew upgrade cocoapods
        pod setup
[✗] iOS tools - develop for iOS devices
    ✗ libimobiledevice and ideviceinstaller are not installed. To install with Brew, run:
        brew update
        brew install --HEAD usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy
[!] Android Studio (not installed)
[!] IntelliJ IDEA Ultimate Edition (version 2019.1.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.36.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
    ! No devices available

こんな感じなのでそれぞれ用意していく

Android toolchain のためにAndroid Studioをインストールする

https://developer.android.com/studio/index.html にアクセスし、ダウンロードする。 自分は新しもの好きなので、 Preview Releases の方を選択してみたかったけど、うまくダウンロードされないので諦めた。

cocoapods の最新化

cocoapods がそもそもインストールされていないので、インストールする

brew install cocoapods

と適当に実行したらインストールされたようなのでそのままインストールが完了するのを待つ。

エラーが発生したので、

brew link --overwrite cocoapods

を実行していいい感じに。

pod setup

を実行してpodを利用できる状態にする。

iOS tools を整える

支持されてたように以下を実行する

brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller

そのあと

brew install ios-deploy

もう一度 flutter doctor を実行する

結果は

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.7.8+hotfix.3, on Mac OS X 10.14.5 18F132, locale ja-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/setup/#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.

[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
[✓] iOS tools - develop for iOS devices
[!] Android Studio (version 3.4)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.1.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.36.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
    ! No devices available

Android toolchain がokになっていないので、一度Android Studioを起動する

起動し、一通り初期のモジュールのインストールが終わったら、以下を実行しライセンスをacceptする。

flutter doctor --android-licenses

Andoroid Studio にFlutter pluginとDart pluginをインストールする

PreferenceのPluginsからFlutterのpluginを検索してインストールする。 Flutterのプラグインをインストールすると依存としてDartプラグインも一緒に入る模様。

ここまでですでにだいぶ疲れる。