Reputation: 1321
I've been using a neat library to handle force-close crashes:
https://github.com/Ereza/CustomActivityOnCrash
It's been working great until I decided to add Firebase Notifications to my app. I've only selected Notifications and as such I've only added the following dependency:
compile 'com.google.firebase:firebase-messaging:10.0.1'
For some reason, Firebase Crash Reports is also being initialized, because the custom crash handler see's it and even displays the following message:
E/CustomActivityOnCrash: IMPORTANT WARNING! You already have an UncaughtExceptionHandler,
are you sure this is correct? If you use ACRA, Crashlytics or similar libraries,
you must initialize them AFTER CustomActivityOnCrash! Installing anyway, but your
original handler will not be called.
My custom crash handler is the very first thing initialized in my (Application) onCreate() method, so I don't see where or how to prevent Firebase Crash reporting from loading/initializing itself.
Any help would be greatly appreciated!
Upvotes: 2
Views: 808
Reputation: 1464
I'm the developer of that library. Versions up to 1.5.0 cause Firebase Crash Reporting to stop working. The app will not crash, but the original UncaughtExceptionHandler
set internally by Firebase will never be invoked, so you will get no crash data in your Firebase console.
This happens even if CustomActivityOnCrash.install()
is called as the first line of your Application
class, because Firebase initializes its UncaughtExceptionHandler
as a provider, therefore ending up executed before the Application
object is instantiated.
Version 2.0.0 of the library fixes this issue by using the same procedure as Firebase (with a provider) but with a higher initOrder
so it executes before the Firebase one.
Update your dependency to make it work as expected (however, be aware of API changes since version 2.x is not compatible with 1.x code):
dependencies {
compile 'cat.ereza:customactivityoncrash:2.0.0'
}
Upvotes: 1
Reputation: 1321
I found my answer thanks to @BobSnyder's comment - it lead me to search and find this previous question/answer:
How to disable default Firebase crash reporting?
and ultimately I am using this answer to solve my issue:
If you want to disable the Firebase Analytics Crash Reporting, use the below
code inside app.gradle file.
configurations {
all*.exclude group: 'com.google.firebase', module: 'firebase-crash'
}
Upvotes: 1