問題
起動すると下記のような例外でアプリが起動しない
flutter run -d XXXXXXXXXXXXX
Launching lib/main.dart on iPhone 11 in debug mode...
Running pod install... 14.3s
Running Xcode build...
└─Compiling, linking and signing... 19.6s
Xcode build done. 205.3s
Configuring the default Firebase app...
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e3cd4c +[NSException raise:format:] + 188
3 Runner 0x000000010ac7e602 +[FIRApp configure] + 130
4 Runner 0x000000010b1d9c89 -[FLTCloudFirestorePlugin init] + 217
5 Runner 0x000000010b1d9a96 +[FLTCloudFirestorePlugin registerWithRegistrar:] + 262
6 Runner 0x000000010ac7984c +[GeneratedPluginRegistrant registerWithRegistry:] + 204
7 Runner <…>
This is taking longer than expected...
対策
FirebaseのコンソールでAppを予め作っておき、 GoogleService-Info.plist
をプロジェクトに追加しておく
その他
チュートリアルにはアプリ作ってから起動している風なこと書いてあるけど全然そんな事ありません
(あたりまえなのかもしれない)
https://codelabs.developers.google.com/codelabs/flutter-firebase/index.html
pubspec.yaml
にfirebase系のdependencyを追加した瞬間からアプリが動かなくなるので、追加するときには作っておきましょう!(という学び)