I have recently switched to new Firebase Crashlytics from Fabric one and I can't find alternative for disabling Crashlytics in debug mode.
Fabric:
val crashlytics = Crashlytics.Builder().core(CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()).build()
Fabric.with(this, crashlytics, Answers())
Anyone know answer? Ive seen that FirebaseCrashlytics
class has its core set up internally now. I've tried FirebaseCrashlytics(CrashlyticsCore.??).getInstance()
, but that kind of constructor is not working.
Also CrashlyticsCore
class no longer has .Builder()
available
I have tried once some time ago which worked for me . Add this to build.gradle
.
android {
buildTypes {
debug {
manifestPlaceholders = [crashlyticsCollectionEnabled:"false"]
...
}
release {
manifestPlaceholders = [crashlyticsCollectionEnabled:"true"]
...
}
}
}
And then set this attribute in manifest .
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="${crashlyticsCollectionEnabled}" />
If you log manually also then you can use something like this at runtime :-
FirebaseCrashlytics.getInstance().recordException(RuntimeException("Invalidtoken"))
Also Check this out and crashlytics opt-in.