77

As per new version of Firebase Crashlytics added in Our App and application stopped at launch time.

java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.IllegalStateException: 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.

App-Level Gradle apply plugin: 'com.google.firebase.crashlytics'

implementation 'com.google.firebase:firebase-crashlytics:17.1.1'

Project-Levle Gradle classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'

Follow steps by step from Firebase guides Firebase Guides

But earlier Fabric version is too much better than current one.

Any help will be appreciated.

seyed Jafari
1,26510 silver badges23 bronze badges
asked Aug 9, 2020 at 10:57
2
  • 1
    Having the same issue. Will post solution here once I figure it out Commented Aug 18, 2020 at 11:02
  • This bug is annoying. We have it and I have done everything to help fixing it but no luck Commented Aug 30, 2020 at 14:52

15 Answers 15

81

In the build.gradle at the application level, add the following imports
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

Then, in the gradle/wrapper/gradle-wrapper.properties file, upgrade your gradle version to 5.6.4
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

I used to run my app with gradle 5.1.1 and upgrading to the version 5.6.4 fixed my problems

I hope it'll help you !

answered Sep 8, 2020 at 13:52
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks, this helped to resolve the issue. I've checked at services.gradle.org/distributions that 5.6.4 is the most recent version 5.
This is why google document sucks. There is no mention of this. Wasted 1 hr trying to add the id somehow by updating google-services.json and what not.
Also remember to include the buildscript dependencies classpath in the root build.gradle as mentioned by Amir Raza
I am trying to remove crashlytics since my team is migrating to Sentry. When i removed all references to Crashlytics i am getting this error E/FirebaseCrashlytics: 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. how do i resolve this?
35

That normally happens when the plugin apply plugin: 'com.google.firebase.crashlytics' is missing in build.gradle app level.

answered Nov 17, 2020 at 18:14

2 Comments

no it's not. please don't make it an exact answer
This worked for me. The docs mention adding crashlytics in 3 different places in the Gradle files, but in a slightly confusing way. I was missing this, and after adding this line in the plugins declaration the crash disappeared.
25

If anyone still have problem with this issue, try using crashlytics gradle verions 2.1.1 in project level gradle. I solved my problem by doing so.

buildscript { 
 ...
 dependencies {
 ... 
 classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1' 
 }
}
answered Nov 4, 2020 at 11:19

1 Comment

While indeed downgrading this from 2.4.1 to 2.1.1 (or even 2.2.1) resolved the issue, it's probably a better option to update the cradle version in the gradle/wrapper/gradle-wrapper.properties file, as instructed by xerib: stackoverflow.com/a/63795391/2439941
25

please add

 classpath 'com.google.firebase:firebase-crashlytics-gradle:x.x.x'

to your project's build gradle. And don't forget to add following lines to your app's build gradle

plugins {
 id 'com.android.application'
 id 'com.google.gms.google-services'
 id 'com.google.firebase.crashlytics'
}
answered May 3, 2021 at 8:21

Comments

12

It will also happen if you forgot to include classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' in your project level build.gradle

buildscript {
 repositories {
 // Check that you have Google's Maven repository (if not, add it).
 google()
 }
 dependencies {
 // ...
 // Check that you have the Google services Gradle plugin v4.3.2 or later
 // (if not, add it).
 classpath 'com.google.gms:google-services:4.3.8'
 // Add the Crashlytics Gradle plugin
 classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
 }
}
allprojects {
 repositories {
 // Check that you have Google's Maven repository (if not, add it).
 google()
 }
}
answered Jul 10, 2021 at 7:09

Comments

9

Solution for Xamarin Forms in the strings.xml or styles.xaml: Add the following line

<string name="com.crashlytics.android.build_id">1</string>

You can get more information here https://github.com/xamarin/GooglePlayServicesComponents/issues/642

LeRoy
4,5562 gold badges40 silver badges48 bronze badges
answered Feb 8, 2023 at 10:38

Comments

6

Add the code below to project/android/app/build.gradle

apply plugin: 'com.google.firebase.crashlytics'

answered Oct 5, 2022 at 12:17

1 Comment

This simple fix worked for me
4

In my case this error is caused by shrinkResources = true (in app/build.gradle) in combination with android-gradle-plugin version 8.3.0-alphaXX.

In order to fix this I had to add a keep.xml file under res/raw/keep.xml with the following input:

<resources xmlns:tools="http://schemas.android.com/tools"
 tools:keep="@string/com.google.firebase.crashlytics.*" />

The actual reason why this bug was introduced by R8 and firebase can be found here: https://github.com/firebase/firebase-android-sdk/issues/5562#issuecomment-1825591774

answered Dec 1, 2023 at 13:49

Comments

1

add this line

implementation "com.google.firebase:firebase-iid"

this will solve this problem

answered Jun 24, 2021 at 9:25

1 Comment

Don't see such a plugin listed @ firebase.google.com/docs/android/setup#available-libraries almost thought this wouldn't work.
1

In my case, the problem was present only on release builds due to R8 being set to "strict". If you're having similar issues with release builds and have R8 enabled, I suggest you add the following entry to your keep.xml file

@string/com_google_firebase_crashlytics_*

In the end should look something like this:

<resources
 xmlns:tools="http://schemas.android.com/tools"
 tools:shrinkMode="strict"
 tools:keep="@string/com_google_firebase_crashlytics_*"/>
answered Aug 10, 2024 at 3:35

Comments

0

After several hours i finally figured it out. I used ./gradlew app:dependencies command to list the dependency tree just to notice, that some libraries (that were not up to date) used older version of crashlytics library. I updated them and the issue was finally gone!

answered Aug 21, 2023 at 18:19

Comments

0

I also struggle with this crash (just in my release builds) and as a temporary fix it helps me to turn off shrinking resources. TBH don't know the reason why it was causing this crash yet 🙃

So you can try to set isShrinkResources = false in your app/build.gradle.kts file if you have it enabled

answered Nov 8, 2023 at 14:19

Comments

0

This solution from google documentation:

Gradle file (project-level)

buildscript {
 repositories {
 // Make sure that you have the following two repositories
 google() // Google's Maven repository
 mavenCentral() // Maven Central repository
 }
 dependencies {
 ...
 // add this line
 classpath ("com.google.firebase:firebase-crashlytics-gradle :2.9.9")
 }
}
allprojects {
 ...
 repositories {
 // Make sure that you have the following two repositories
 google() // Google's Maven repository
 mavenCentral() // Maven Central repository
 }
}

module (app-level) Gradle file

plugins {
 id("com.android.application")
 // Add the ID of the plugin
 id("com.google.firebase.crashlytics")
 ...
}
answered Dec 18, 2023 at 21:07

Comments

0
Step 1) In your build.gradle.kts file (Project) to past this line
plugins {
id ("com.google.gms.google-services") version "4.3.15" apply false
id ("com.google.firebase.crashlytics") version "2.9.1" apply false
}
Step 2) In your build,gradle.kts(App) to past this line
 plugins {
 
 id("com.google.gms.google-services")
 id("com.google.firebase.crashlytics")
 }
dependencies {
 implementation("com.google.firebase:firebase-analytics-ktx:21.6.2")
 implementation("com.google.firebase:firebase-crashlytics-ktx:18.6.4")
 implementation("com.google.firebase:firebase-perf:20.5.2")
}

Comments

-1

For those who added the classpath but still ran into the exception, make sure that there isn't a space between the colon and the version number, oddly it'll still crash.

Crash:

classpath 'com.google.firebase:firebase-crashlytics-gradle: 2.9.9' // look at the space in between the colon and 2.9.9

No Crash:

classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9' // no space in between the colon and 2.9.9
answered Apr 8, 2024 at 1:06

2 Comments

This worked for me . No Space in between the colon and version will solve the crash issue.
@KiranSrinivasRao, hi, if it worked please upvote this answer so others can see it works

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.