繁体   English   中英

Firebase Crashlytics 从 Fabric Crashlytics 更新后在运行时崩溃

[英]Firebase Crashlytics Crashed in runtime after Updated From Fabric Crashlytics

我已将 Fabric Crashlytics 迁移到 Firebase Crashlytics。 现在应用程序在运行时崩溃

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)
  

我的 Gradle 看起来像这样

项目级别 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
}

应用级 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'

再次崩溃部署后,它起作用了。 但是当我再次部署时它崩溃了。 这是一个循环。 第一次部署->第二次部署崩溃->工作正常

我想每次都运行该应用程序而不会出现任何运行时崩溃。 我找不到任何问题。 我已删除maven { url 'https://maven.fabric.io/public' }并测试应用程序,但结果相同。 没有改变。 我还清理了项目并完成了使缓存无效并重新启动但无法正常工作。 我正在寻找解决方案。 请帮忙

从您的build.gradle中删除ext.enableCrashlytics = false

如果您不想为调试版本上传映射文件,请使用:

debug {
    minifyEnabled true
    firebaseCrashlytics {
        mappingFileUploadEnabled false
    }
}

要为您的调试版本禁用 Crashlytics,请将其添加到您的应用程序 class:

FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM