Firebase Crashlytics not consistently reporting
Please fill in the following fields:
Unity editor version: Unity 2018.1.8 Firebase Unity SDK version: 5.6.1 Firebase plugins in use (Auth, Database, etc.): Cloud Messaging, Firebase Analytics, Firebase Crashlytics Additional SDKs you are using (Facebook, AdMob, etc.): - Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows, Mac Platform you are targeting (iOS, Android, and/or desktop): Android, iOS
Please describe the issue here:
After migrating from the Fabric Crashlytics SDK to the Firebase Crashlytics SDK, crash reports have been reported inconsistently. This happens in both Android and iOS builds.
Forced Exceptions for testing and in-game errors are not consistently being reported in the Firebase Crashlytics dashboard. I have not been able to figure out why some are ignored and why others end up in the dashboard.
Previously, with the Fabric Crashlytics SDK it would only take 5 minutes for a forced test Exception to appear in the Firebase Crashlytics Dashboards, and it would be consistent (all reports are properly sent).
By enabling the FirebaseApp verbose logging in an Android device, I see this error after triggering Crash Reports:
I/Unity (23485): Reading message file, errno=4
I/Unity (23485): UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
I/Unity (23485): UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
I/Unity (23485): UnityEngine.Logger:Log(LogType, Object)
I/Unity (23485): UnityEngine.Debug:Log(Object)
I/Unity (23485): Firebase.Platform.FirebaseLogger:LogMessage(PlatformLogLevel, String) (at Z:\tmp\tmp.LtORB920jN\firebase\app\client\unity\src\Unity\FirebaseLogger.cs:13)
I/Unity (23485): Firebase.FirebaseApp:LogMessage(LogLevel, String) (at Z:\tmp\tmp.WzZlxqG9dg\firebase\app\client\unity\proxy\FirebaseApp.cs:93)
I/Unity (23485):
I/Unity (23485): (Filename: Z Line: 0)
Besides this, I can only see Firebase Analytics and Cloud Messaging logging successful initialization. Is it expected to also see a Firebase log for Crashlytics initialization?
Please answer the following, if applicable:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? Haven't tried yet to create an empty project with Crashlytics due to time constraint.
@henriqueranj -
Depending on the number of crashes reported to Crashlytics, the reporting queue may be backed up. Please note, even though you usually see reports within 5 minutes, it sometimes may take longer.
What version of the SDK are you using?
Here are some steps that you can follow to help gather additional information.
- Collect debug logs To enable debug logging, add the following line (before Crashlytics is initialized):
...
Firebase.FirebaseApp.LogLevel = Firebase.LogLevel.Debug; // ⇐ !!!
// Initialize Firebase
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
var dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
// Create and hold a reference to your FirebaseApp,
// where app is a Firebase.FirebaseApp property of your application class.
// Crashlytics will use the DefaultInstance, as well;
// this ensures that Crashlytics is initialized.
Firebase.FirebaseApp app = Firebase.FirebaseApp.DefaultInstance;
// WARNING: Do not call Crashlytics APIs from asynchronous tasks;
// they are not currently supported.
// Set a flag here for indicating that your project is ready to use Firebase.
}
else
{
UnityEngine.Debug.LogError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}",dependencyStatus));
// Firebase Unity SDK is not safe to use here.
}
....
To verify debug logging is enabled correctly, you should see the following highlighted message:
[Firebase/Analytics][I-ACS023009] Debug logging enabled
-
Check to see if Crashlytics initialized successfully in the app Search for the following message, in the customer’s log:
Registering Crashlytics exception handlers -
Check to see if the crash was reported to Crashlytics After the crash/non-fatal, re-launch the app and check for the following log message (do a partial search without the unique ids):
iOS -
Packaged report with id ‘9620c7027e4344f1932488d813d00a16’ for submission
Android -
I/CrashlyticsCore: Crashlytics report upload complete: 5C9261570237-0001-128B-B30AE9599464
- Check the Firebase Console Filter Exceptions from Unity/C# are non-fatal. On the Firebase console, make sure the "Event type = Crashes" filter is not applied.
Hello @jasonhu-g , thank you for all the tips on how to debug the Firebase SDK.
I am indeed only seeing the Packaged report with id ‘xxx’ for submission after reopening the app. So only at this point the non-fatal error is reported to Crashlytics? This is a different behaviour from the original Fabric Crashlytics SDK, correct?
Also, the non-fatal reports in the dashboard do not have any logs associated to them. Is this expected behaviour? I strictly forced Crashlytics logs to happen before triggering a Non-fatal error.
Further, after a few restart I noticed that the app froze with a crash related to Firebase Analytics native libraries. I will open a different issue request for this.
[Edit:] I am using Firebase SDK 5.6.1 with its included Firebase Crashlytics SDK.
Hi @henriqueranj,
Yes, the app has to be re-launched before fatals/non-fatals are reported. This behavior has not changed from the Fabric Crashlytics SDK.
For the missing logs, is the issue reproducible? Do you have any sample code that you can share? Is the log happening on the same thread as where you are triggering the crash?
Hello @jasonhu-g ,
I think I may understand now why the logs seem to be inconsistently reported. Upon a reported error, is the log flushed and cleared? Therefore, the next reported error will not contain all the logs gathered before the previous error?
Following this example:
- Log 1
- Log 2
- Log 3
- Error A
- Log 4
- Log 5
- Error B
- Error C
In Crashlytics, I will see:
- Error A: contains Logs 1 to 3
- Error B: contains Logs 4 to 5
- Error C: contains no logs.
Does this seem correct you?
I upgraded my project to use the latest Firebase SDK 6.0.0
Hi @henriqueranj,
In your example above, that is the expected behavior.
Hi @jasonhu-g , thanks for the confirmation.
Even though this is expected behaviour, is it desired behaviour to Firebase's roadmap with Crashlytics? This can hinder the assessment of crashes when non-fatals happen before it. Also makes it hard to track down if an error was caused due to a "snowball" effects of errors within the app.
Specially since there is no easy way to track a user session within Crashytics. Or do you have any tips on how to track down all the sequence of reported errors and logs from a user? I am aware and I am using the User ID feature, but all I can seem to use it is for filtering by User ID in the Crashlytics dashboard.
Thanks for the feedback, we will consider it for a future change.
In the meantime, if you set a unique user id at app launch, then you can search for all crashes associated with that session. Then you go through the crashes to view all logs for the session.