firebase / flutterfire

πŸ”₯ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.44k stars 3.91k forks source link

[firebase_crashlytics]: [Android] App stuck on splash screen because of Crashlytics exception #12692

Closed fbardecio closed 2 weeks ago

fbardecio commented 3 weeks ago

Is there an existing issue for this?

Which plugins are affected?

Crashlytics

Which platforms are affected?

Android

Description

The app should initialize with no problems, allowing me to log crashes to Crashlytics.

Flutter Doctor:

Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-UY)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 15.3)
    ! CocoaPods 1.12.1 out of date (1.13.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 see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions.
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2023.2)
[βœ“] VS Code (version 1.72.1)
[βœ“] VS Code (version 1.88.1)
[βœ“] Connected device (5 available)
[βœ“] Network resources

After migrating from Flutter SDK 3.16.9 to Flutter SDK 3.19.6, the Android release build gets stuck in the splash screen, these are the logs:

D/FlutterGeolocator(15679): Creating service.
D/FlutterGeolocator(15679): Binding to location service.
D/FlutterGeolocator(15679): Flutter engine connected. Connected engine count 1
E/flutter (15679): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'bool'
E/flutter (15679): #0      new FirebaseCrashlyticsPlatform.instanceFor (package:firebase_crashlytics_platform_interface/src/platform_interface/platform_interface_crashlytics.dart:34)
E/flutter (15679): #1      FirebaseCrashlytics._delegate (package:firebase_crashlytics/src/firebase_crashlytics.dart:24)
E/flutter (15679): #2      FirebaseCrashlytics.setCrashlyticsCollectionEnabled (package:firebase_crashlytics/src/firebase_crashlytics.dart:194)
E/flutter (15679): #3      bootstrap (package:app/bootstrap.dart:46)
E/flutter (15679): <asynchronous suspension>
E/flutter (15679): 

Line 46 in bootstrap file is making use of kDebugMode constant for set the Crashlytics collection value, I've also tried removing it and providing true to it but it throws same errors.

await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true); // This also fails

If I remove Crashlytics from the project everything works as expected.

Reproducing the issue

Add Crashlytics to a project and run in release mode or make a build and open it in a physical device.

Firebase Core version

2.30.0

Flutter Version

3.19.6

Relevant Log Output

D/FlutterGeolocator(15679): Creating service.
D/FlutterGeolocator(15679): Binding to location service.
D/FlutterGeolocator(15679): Flutter engine connected. Connected engine count 1
E/flutter (15679): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'bool'
E/flutter (15679): #0      new FirebaseCrashlyticsPlatform.instanceFor (package:firebase_crashlytics_platform_interface/src/platform_interface/platform_interface_crashlytics.dart:34)
E/flutter (15679): #1      FirebaseCrashlytics._delegate (package:firebase_crashlytics/src/firebase_crashlytics.dart:24)
E/flutter (15679): #2      FirebaseCrashlytics.setCrashlyticsCollectionEnabled (package:firebase_crashlytics/src/firebase_crashlytics.dart:194)
E/flutter (15679): #3      bootstrap (package:app/bootstrap.dart:46)
E/flutter (15679): <asynchronous suspension>
E/flutter (15679):

Flutter dependencies

Expand Flutter dependencies snippet
```yaml firebase_core: ^2.30.0 firebase_crashlytics: ^3.5.3 firebase_messaging: ^14.8.2 firebase_performance: ^0.9.4+2 firebase_storage: ^11.7.2 ```

Additional context and comments

No response

russellwheatley commented 3 weeks ago

Hi @fbardecio - I tested on release mode, flutter v3.19.6 using Crashlytics example app, no crash for me. You'll need to create a small, reproducible code sample/repo to investigate. Thanks.

fbardecio commented 3 weeks ago

Hey @russellwheatley thanks for taking a look into this issue, I will try to reproduce this in a small project during this weekend and share access to it/any news with you!

russellwheatley commented 2 weeks ago

@fbardecio Thanks πŸ™

fbardecio commented 2 weeks ago

I've created a new project with only the specified Firebase dependencies and I was not able to reproduce this issue, it is probably related to some other Android configuration located in my main project repository, I will keep investigating, thanks for taking your time to review it πŸ™Œ