【问题标题】:Firebase Crash report not appearing in android after Firebase crashlytics updateFirebase crashlytics 更新后,Firebase 崩溃报告未出现在 android 中
【发布时间】:2020-11-16 09:11:48
【问题描述】:

在 Android 中更新 Firebase crashlytics 依赖项后,我无法查看崩溃报告。甚至我的 Firebase 控制台也显示“您安装了最新的 SDK”。请参考我的构建细节。

build.gradle

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.2'
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
    }
}

allprojects {
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        maven {                                 
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter()
    }
}

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

build.gradle(:app)

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

android {
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

    compileSdkVersion 28

    defaultConfig {
        applicationId "com.XXX.XXX"
        minSdkVersion 16
        targetSdkVersion 28
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        renderscriptSupportModeEnabled true
        multiDexEnabled true
    }

    buildTypes {
        release {
            // signingConfig signingConfigs.release
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            // resValue "string", "app_name", "$app_name_release"
        }

        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug"
            buildConfigField "String", "TYPE", '"DEBUG"'
        }
    }
    flavorDimensions "mode", "key"

    productFlavors {
        lite {
            dimension "mode"
            applicationId "com.xxx.xxx"
            versionCode 23
            versionName "4.4.3"
            manifestPlaceholders = [app_name: "Pro-Inspector"]
        }

        pi {
            dimension "mode"
            applicationId "com.xxx.xxx"
            versionCode 53
            versionName "4.4.3"
            manifestPlaceholders = [app_name: "Pro-Inspector"]
        }

        local {
            dimension "key"
        }

        sandbox {
            dimension "key"
        }

        demo {
            dimension "key"
        }

        dev {
            dimension "key"
        }

        production {
            dimension "key"
        }

        live {
            dimension "key"
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    variantFilter { variant ->
        def modeName = variant.flavors*.name
        def keyName = variant.flavors*.name

        // To check for a certain build type, use variant.buildType.name == "<buildType>"
        // Gradle ignores any variants that satisfy the conditions below

        if (modeName.contains("lnt") && keyName.contains("demo")) {
            setIgnore(true)
        }
        if (modeName.contains("pi") && keyName.contains("dev")) {
            setIgnore(true)
        }
        if (modeName.contains("pi") && keyName.contains("production")) {
            setIgnore(true)
        }
        if (modeName.contains("lnt") && keyName.contains("live")) {
            setIgnore(true)
        }
    }
}

dependencies {
    implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
    implementation 'com.google.firebase:firebase-analytics:18.0.0'
    implementation 'com.google.firebase:firebase-core:18.0.0'
    implementation 'com.google.firebase:firebase-messaging:21.0.0'
    implementation 'com.google.firebase:firebase-auth:20.0.0'
    implementation 'com.google.firebase:firebase-messaging-directboot:21.0.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    // RETROFIT
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    // GLIDE
    implementation 'com.github.bumptech.glide:glide:4.3.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
    // VIEWMODEL
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.0.0'
    api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'

    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.google.android.material:material:1.1.0-alpha02'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.daasuu:EasingInterpolator:1.0.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.2'
    implementation 'com.google.android.gms:play-services-location:17.1.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-identity:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.1.0'
    implementation 'com.google.android.gms:play-services-places:17.0.0'
    implementation 'org.adw.library:discrete-seekbar:1.0.1'
    implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    androidTestImplementation 'androidx.multidex:multidex:2.0.1'
    androidTestImplementation 'androidx.multidex:multidex-instrumentation:2.0.0'
    implementation 'commons-io:commons-io:2.0.1'
    testImplementation 'junit:junit:4.12'
    implementation project(':pdfviewer')

    //retrofit dependencies
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
 
}
apply plugin: 'com.google.gms.google-services'

有人遇到过这个问题吗?谁能帮我在控制台中查看崩溃

【问题讨论】:

    标签: android firebase crashlytics


    【解决方案1】:

    我也遇到了同样的问题,为了解决这个问题,我做了以下步骤。

    1. 添加新的 Crashlytics SDK 之后。从 Firebase 控制台下载新的 Google-services.json 文件(您可以从 Firebase 控制台的项目设置中获取)

    2. 第一次强制崩溃。

       throw new RuntimeException("Test Crash");
      
    3. 运行你的应用程序。它会崩溃,因为我们在上面添加了运行时异常。

    现在检查您的 Firebase 控制台。你可以看到崩溃报告

    参考HERE

    【讨论】:

    • 第一次,我的应用程序崩溃未显示在控制台中。发生此崩溃后,我的其他应用程序崩溃显示在控制台中。谢谢 。注意:我们也需要启用控制台设置。
    • @Gowrisankari Ravindran “启用控制台设置”是什么意思?我有同样的问题,但无法解决。
    • @MohammadRezaLohrasbi 只需确保您的应用程序(调试和发布)在 firebase 中启用 Crashlytics 设置。没有任何其他特殊权限。 Firebase 控制台 -> 选择项目 -> 质量(左侧菜单)->Crashlytics ->启用
    猜你喜欢
    • 2019-04-18
    • 1970-01-01
    • 1970-01-01
    • 2021-06-10
    • 1970-01-01
    • 2021-06-30
    • 1970-01-01
    • 1970-01-01
    • 2018-11-29
    相关资源
    最近更新 更多