question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crashlytics setup crashes app on every second run

See original GitHub issue

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general Firebase discussion, use the firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 3.4.2
  • Firebase Component: Crashlytics
  • Component version: 17.1.1
  • Crashlytics Gradle plugin version: 2.2.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

On every second start of the app, it crashes during startup with the following error:

 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.
        at android.app.ActivityThread.installProvider(ActivityThread.java:5265)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4847)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4787)
        at android.app.ActivityThread.access$1600(ActivityThread.java:154)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1452)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:234)
        at android.app.ActivityThread.main(ActivityThread.java:5526)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: 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.
        at com.google.firebase.crashlytics.internal.common.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:122)
        at com.google.firebase.crashlytics.FirebaseCrashlytics.init(FirebaseCrashlytics.java:165)
        at com.google.firebase.crashlytics.CrashlyticsRegistrar.buildCrashlytics(CrashlyticsRegistrar.java:55)
        at com.google.firebase.crashlytics.CrashlyticsRegistrar.access$lambda$0(CrashlyticsRegistrar.java)
        at com.google.firebase.crashlytics.CrashlyticsRegistrar$$Lambda$1.create(CrashlyticsRegistrar.java)
        at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:firebase-components@@16.0.0:69)
        at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(com.google.firebase:firebase-components@@16.0.0)
        at com.google.firebase.components.Lazy.get(com.google.firebase:firebase-components@@16.0.0:53)
        at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:firebase-components@@16.0.0:158)
        at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:firebase-common@@19.3.0:563)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:304)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:268)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:253)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.3.0:51)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)

It seems to be a crashlytics gradle plugin issue, as it deletes com_crashlytics_build_id.xml in build\generated\crashlytics on every second run, thus causing the crash. It works with gradle plugin 2.1.1

Relevant Code:

Project level build.gradle excerpt:

classpath 'com.android.tools.build:gradle:3.4.3'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'

Module level build.gradle excerpt:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.appid"
        minSdkVersion 21
        targetSdkVersion 28
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
        }
    }
}

dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-dynamic-links:17.0.0'
    implementation 'com.google.android.gms:play-services-ads:17.2.0'
    implementation 'com.google.firebase:firebase-crashlytics:17.1.1'
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
tsengvncommented, Aug 6, 2020

my team run into the same problem and we managed to workaround like this (to make the gradle always generate the file for us)

tasks.whenTaskAdded { task ->
        if (task.name.startsWith("injectCrashlyticsMappingFileId")) {
            task.outputs.upToDateWhen { false }
        }
    }

Hope we can know the root cause of this issue

1reaction
songzhangzhangcommented, Sep 3, 2020

I have the same issue. After upgrading gradle to 5.6.4, it’s resolved.

At first I use gradle 5.1.1, but it seems to not work with firebase-crashlytics-gradle 2.2.0.

I update the gradle-wrapper.properties like this: distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crashlytics troubleshooting and FAQ - Firebase
Crashes are poorly symbolicated. If your stack traces seem to be poorly symbolicated, check the following: If frames from your app's library lack...
Read more >
I cannot view crash detail of Firebase Crashlytics for android ...
First follow the official doc's link to include all dependencies as it is given there and setup your firebase app through firebase console....
Read more >
Logging Ad Response ID with Firebase Crashlytics | Android
In the Crashlytics page of the Firebase console, click Set up Crashlytics. In the screen that appears, click No > Set up a...
Read more >
Firebase Crashlytics implementation in iOS app - Medium
Test it out ... Finally, after the project is setup successfully the console would initially look like. Now, run your app on the...
Read more >
Crashlytics - FlutterFire
Logs: Log events in your app to be sent with the crash report for context if your app crashes. · Crash reports: Every...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found