Wednesday, 23 January 2019

Crashlytics/Fabric initializationCallback not called

Trying to implement two crash handlers with crashlytics (as discussed in Crashlytics Android SDK - custom UncaughtExceptionHandler) I can not get the intializationCalback to work - in Kotlin. Is somebody having the same issue or is there something wrong with my code? (To clarify: neither the success nor the failure method are ever called, hence the new UncaughtException Handler is also not executed)

val core = CrashlyticsCore.Builder()
    .build()
Fabric.with(
    Fabric.Builder(contextProvider.invoke()).kits(
        Crashlytics.Builder()
            .core(core)
            .build()
    ).initializationCallback(object : InitializationCallback<Fabric> {
        override fun success(fabric: Fabric) {
            var mDefaultUEH = Thread.getDefaultUncaughtExceptionHandler()
            Thread.setDefaultUncaughtExceptionHandler { t, e ->
                Log.e("CrashLogger","Excpetion",e)
                mDefaultUEH.uncaughtException(t, e)
            }
        }

        override fun failure(e: Exception) {
            Log.e("CrashLogger", "Error during initialization ", e)
        }
    }
    ).build()
)



from Crashlytics/Fabric initializationCallback not called

No comments:

Post a Comment