Closed1

Flutter 導入

biwakonbubiwakonbu

Ubuntu にインストール

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

ubuntu だと snap で flutter をインストールするらしい。

$ sudo snap install flutter --classic

依存ツールは android-studio とか cmdline-tools とか。

doctor で確認して足りてないものを入れていく流れ。

$ flutter doctor                                                                                           
Doctor summary (to see all details, run flutter doctor -v):                                                            
[✓] Flutter (Channel stable, 3.0.3, on Ubuntu 20.04.4 LTS 5.13.0-51-generic, locale ja_JP.UTF-8)                       
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)                                       
    ✗ cmdline-tools component is missing                                                                               
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`                                                        
      See https://developer.android.com/studio/command-line for more details.                                          
    ✗ Android license status unknown.                                                                                  
      Run `flutter doctor --android-licenses` to accept the SDK licenses.                                              
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.                           
[✓] Chrome - develop for the web                                                                                       
[✓] Linux toolchain - develop for Linux desktop                                                                        
[✓] Android Studio (version 2021.2)                                                                                    
[✓] VS Code (version 1.68.1)                               
[✓] Connected device (2 available)                         
[✓] HTTP Host Availability

android-studio とか SDK インストール

https://developer.android.com/studio#downloads

android-studio とか cmdline-tools とか無ければ公式からダウンロードして入れる。
この辺わざわざページ訪問しなくていい方法あれば楽なのに。

とりあえず android-studio を入れて起動、[Projects] > [More Actions] > [SDK Manager] > [SDK Tools] から android SDK Comman-line Tools を入れる。

$ flutter doctor                                                                                   
Doctor summary (to see all details, run flutter doctor -v):                                                            
[✓] Flutter (Channel stable, 3.0.3, on Ubuntu 20.04.4 LTS 5.13.0-51-generic, locale ja_JP.UTF-8)                       [!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)                                       
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses                     
[✓] Chrome - develop for the web                                                                                       [✓] Linux toolchain - develop for Linux desktop                                                                        
[✓] Android Studio (version 2021.2)                                                                                    
[✓] VS Code (version 1.68.1)                                                                                           [✓] Connected device (2 available)                                                                                     
[✓] HTTP Host Availability  

toolchain は導入完了。
lisense の確認だけ残っているので指定されたコマンド実行して終わり。

$ flutter doctor --android-lisenses
# 確認して y するだけ
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):                                                           
[✓] Flutter (Channel stable, 3.0.3, on Ubuntu 20.04.4 LTS 5.13.0-51-generic, locale ja_JP.UTF-8)                
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)                                       [✓] Chrome - develop for the web                                                                                       
[✓] Linux toolchain - develop for Linux desktop                                                                        
[✓] Android Studio (version 2021.2)                                                                                    [✓] VS Code (version 1.68.1)                                                                                           
[✓] Connected device (2 available)                                                                                     
[✓] HTTP Host Availability   

完了。

このスクラップは2024/05/06にクローズされました