環境セットアップ
セットアップ手順
Step 1: Homebrew でツールをインストール
`# FVM brew install fvm
Node.js 20
brew install node@20
Java(Firebase Emulator用)
brew install openjdk@11
CocoaPods
brew install cocoapods`
Step 2: Firebase CLI をインストール
npm install -g firebase-tools
firebase login
Step 3: Flutter をセットアップ
# プロジェクトディレクトリで実行
fvm install # .fvmrc に指定された Flutter 3.38.5 をインストール
fvm use # プロジェクトで使用するFlutterバージョンを設定
Step 4: 依存関係をインストール
`# Flutter パッケージ fvm flutter pub get
Cloud Functions の依存関係
cd functions && npm install && cd ..
セキュリティルールテスト用の依存関係
npm install`
Step 5: iOS 依存関係(macOSの場合)
cd ios && pod install && cd ..
Step 6: Download & Install Android Studio
- Go to: https://developer.android.com/studio
- Download Android Studio for Mac (Apple Silicon)
- Open the .dmg and drag Android Studio to Applications
- Launch Android Studio and complete the setup wizard
- Choose "Standard" installation
下記エラーが出た Intel mac版をいれてしまったらしい
Cannot start the runtime Caused by: 0: Failed to load 'libjli.dylib' 1: dlopen(/Applications/Android Studio.app/Contents/jbr/Contents/Home/lib/libjli.dylib, 0x0001): tried: '/Applications/Android Studio.app/Contents/jbr/Contents/Home/lib/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64e.v1' or 'arm64' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Applications/Android Studio.app/Contents/jbr/Contents/Home/lib/libjli.dylib' (no such file), '/Applications/Android Studio.app/Contents/jbr/Contents/Home/lib/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64e.v1' or 'arm64' or 'arm64')) Please try to reinstall the IDE. For support, please refer to https://jb.gg/ide/critical-startup-errors
Step 7: After installation, run these commands:
- Accept Android licenses
flutter doctor --android-licenses
アップデートがあれば
flutter upgradeここで苦戦中
flutter config --list All Settings: enable-web: (Not set) enable-linux-desktop: (Not set) enable-macos-desktop: (Not set) enable-windows-desktop: (Not set) enable-android: (Not set) enable-ios: (Not set) enable-fuchsia: (Not set) (Unavailable) enable-custom-devices: (Not set) cli-animations: (Not set) enable-native-assets: (Not set) enable-dart-data-assets: (Not set) (Unavailable) enable-swift-package-manager: (Not set) omit-legacy-version-file: (Not set) enable-windowing: (Not set) (Unavailable) enable-lldb-debugging: (Not set) enable-uiscene-migration: (Not set)
- Verify setup
flutter doctor
動作確認
Flutter 環境の確認
fvm flutter doctor
Firebase Emulator でテスト実行
npm run emulator:exec
アプリの起動
fvm flutter run