lastly I'm struggling with Android Crashes from firebase. We are using unity latest version:
We initialize it with the options:
Application = firebaseOptions != null ? FirebaseApp.Create(firebaseOptions) : FirebaseApp.DefaultInstance;
Normally the game is working correctly, firebase implementation looks good, events are getting captured etc. Unfortunately, we have a lot of crashes with stacktrace:
Did anyone have the same issue? How to resolve it? We can't reproduce the issue, We even don't know how does it happen at all, as stack trace is running clearly right from the Google team code.
I assume it's a work that is checking if the app wasn't removed from the phone.
Fatal Exception: java.lang.IllegalStateException: FirebaseApp was deleted
at com.google.android.gms.common.internal.Preconditions.checkState(com.google.android.gms:play-services-basement@@17.6.0:2)
at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:439)
at com.google.firebase.FirebaseApp.getApplicationContext(FirebaseApp.java:126)
at com.google.firebase.installations.FirebaseInstallations.insertOrUpdatePrefs(FirebaseInstallations.java:444)
at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:401)
at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:377)
at com.google.firebase.installations.FirebaseInstallations$$Lambda$4.run(:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)```
I've managed to resolve an issue.
First of all, it was the problem of overriding DefaultInstance of the firebase app. more you can find here: Firebase issue
And here is how can you resolve it, links were provided to me by firebase support. At the moment we are preventing auto initialization of the app, and at runtime, we create a fresh firebase app, it's the first thing we do in the launcher.
https://firebase.googleblog.com/2017/03/take-control-of-your-firebase-init-on.html
You can also learn more about firebase initialization process here: https://firebase.googleblog.com/2016/12/how-does-firebase-initialize-on-android.html