We have programming an Android app and try to implement Crashlytics to our app.
We have different types of problem . Version we used : Android studio version : 3.3
Gradle version : classpath 'com.android.tools.build:gradle:3.3.1'
Plugin : Fabric for Android studio v4.3.0
Implementation : implementation('com.crashlytics.sdk.android:crashlytics:2.9.9') { transitive = true } implementation('io.fabric.sdk.android:fabric:1.4.0@aar') { transitive = true }
gradle-wrapper.properties : distributionUrl=https://services.gradle.org/distributions/gradle-5.2.1-all.zip
First Problem :
When we implement Crashlytics, you know that developers have 3 steps. We can not skip 2,3.steps. Because we have not compiled our application yet. We had two main errors:
Error 1:
This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up,
Error 2 :
E/CrashlyticsCore: The Crashlytics build ID is missing.This occurs when
Crashlytics tooling is absent from your app's build configuration.
Please review Crashlytics onboarding instructions and ensure you have a valid Crashlytics account.
So, we had to be disabled "Debug Mod" to complete implementation of Crashlytic.
Crashlytics crashlyticsKit = new Crashlytics.Builder()
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build();
Fabric.with(this, crashlyticsKit); // Tod from Fabric suggested in stackoverflow
And implementation was completed.
But we do not want to do that. Because, when we have a crash, it does not any report to Crashlytics or Firebase. We also want to have debug mod’s crashes.
When we removed -> ....disabled(BuildConfig.DEBUG)
- it shows again : Error 1, Error 2.
Second Problem :
In gradle ; apply plugin : ‘io.fabric’, we made the comment line, when we remove comments line, we have errors below :
Error 3 :
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
Affected Modules: app
When we searched it, this error related to new android studio gradle. So we needed to make comment line “apply plugin: fabric.io” again.
There is no good solution about that.
To run application we can not remove:
new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()
: (due to Error1 Error2)
So we try to enable report different ways :
What have we try to add until here?
1. Enable in gradle :
buildTypes {
debug {
manifestPlaceholders = [crashlyticsEnabled: true]
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
manifestPlaceholders = [crashlyticsEnabled: false]
}
2. Enable in Manifest
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="true" />
3.Enable in ADB
adb shell setprop log.tag.Fabric DEBUG
adb shell setprop log.tag.CrashlyticsCore DEBUG
But still, Crashlytics or Firebase does not get any Debug Crash reports.
We have expecting your solutions.
This also happens if you set ext.enableCrashlytics = false
for a build variant but still try to call Fabric.with(context, Crashlytics())
in your app initialization code. ext.enableCrashlytics = false
disables the build plugin (an optimization I made to make my debug builds faster) but then of course the build ID will be missing.