An uncaught exception can be delegated back to the system, preserving the old exception handler and passing fuzzy exceptions to it.
First create a class Applicationas shown below:
public class Controller extends Application {
private static Thread.UncaughtExceptionHandler defaultHandler;
@Override
public void onCreate() {
super.onCreate();
if (defaultHandler == null) {
defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
}
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
FirebaseCrash.report(e);
defaultHandler.uncaughtException(t, e);
}
});
}
}
:
<application
android:name=".Controller"
... />