Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Crashlytics Crashed in runtime after Updated From Fabric Crashlytics

I have migrated Fabric Crashlytic to Firebase Crashlytics. Now App is crashing in runtime

Process: com.treinetic.whiteshark, PID: 29371
    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:6537)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6025)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5931)
        at android.app.ActivityThread.access$1200(ActivityThread.java:200)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1673)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:201)
  

My Gradle look like this

Project level build.gradle

buildscript {
    ext.kotlin_version = '1.3.11'
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'

        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'

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


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}



task clean(type: Delete) {
    delete rootProject.buildDir
}

App level build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'


android {

    compileSdkVersion 29
    defaultConfig {
        applicationId "com.myapp.app"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 15
        versionName "1.1.2"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
            ext.enableCrashlytics = false

        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
    dataBinding {
        enabled = true
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }

    packagingOptions {
        exclude 'META-INF/core_release.kotlin_module'
        exclude 'META-INF/MyApplication_debug.kotlin_module'
        exclude 'META-INF/appname_debug.kotlin_module'
        exclude 'META-INF/appname_debug.kotlin_module'
        exclude 'META-INF/appname_release.kotlin_module'
        exclude 'META-INF/appname_debug.kotlin_module'


    }
    testOptions {
        unitTests.returnDefaultValues = true
//        unitTests {
//            includeAndroidResources = true
//        }
        sourceSets {
            test {
                resources.srcDirs += ['src/test/resources']
            }
            androidTest {
                resources.srcDirs += ['src/androidTest/resources']
            }
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'

    implementation 'com.google.android.material:material:1.1.0-alpha02'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
    implementation 'com.android.support:multidex:1.0.3'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha01'

    //FIREBASE

    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:20.2.1'
//    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.google.firebase:firebase-crashlytics:17.0.0'
    implementation 'com.google.firebase:firebase-analytics:17.4.2'

    //GLIDE
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    kapt 'com.github.bumptech.glide:compiler:4.9.0'

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    def multidex_version = "2.0.1"
    implementation "androidx.multidex:multidex:$multidex_version"

    def lifecycle_version = "2.0.0"
    // ViewModel and LiveData
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"

    //ROOM DATABASE
    def room_version = "2.0.0-beta01"
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"

.....

}

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

After crashed deployed again it worked. But when I deployed again it crashed. This happens as a cycle. First time deployed-> crashed second-time deployed-> work fine

I want to run the app every time without any run time crash. I cannot find any issues. I have removed maven { url 'https://maven.fabric.io/public' } and test the app but the same result. Nothing changed. I also clean the project and done invalidate the cache and restart but not working. I am looking for a solution. Please help

like image 665
Nuwan Chamara Avatar asked Jun 30 '20 12:06

Nuwan Chamara


1 Answers

Remove ext.enableCrashlytics = false from your build.gradle.

If you don't want to upload mapping files for your debug builds, use this:

debug {
    minifyEnabled true
    firebaseCrashlytics {
        mappingFileUploadEnabled false
    }
}

To disable Crashlytics for your debug builds, add this to your application class:

FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG)
like image 75
Saurabh Thorat Avatar answered Oct 19 '22 04:10

Saurabh Thorat