You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Firebase Crashlytics仅在预发布测试时接收崩溃报告求助

Firebase Crashlytics 本地构建无法上报崩溃问题

我已反复按照Firebase官方的Android集成及Crashlytics初始化步骤验证配置:

  • 确认google-services.json文件正确(重新下载对比过,可正常用于Firebase消息推送)
  • 已启用Analytics共享
  • Firebase控制台中已为应用开启Crashlytics

运行应用时,部分非崩溃类JSON报告能成功上传并返回204状态,但存在以下错误:

  • 应用启动时报错:E/FirebaseCrashlytics: Settings request failed. java.io.FileNotFoundException: https://firebase-settings.crashlytics.com/spi/v2/platforms/android/gmp/(snip)&build_version=99&display_version=2022.08.31.99
  • 点击“TEST CRASH”按钮触发崩溃时,报错:E/FirebaseCrashlytics: Cannot send reports. Timed out while fetching settings.

但将应用上传至Google Play封闭预发布测试时,崩溃报告可正常显示,包括测试崩溃按钮触发的崩溃,能获取无崩溃用户数、日志、堆栈跟踪等完整信息,说明配置本身是正确的。

测试细节补充:

  • 设备安装了Proton VPN,但测试时已禁用,无影响
  • 无论是Google Play下载的Beta版,还是Android Studio编译的Debug/Release版(通过USB调试安装,安装前已卸载其他版本),均无法上传崩溃报告
  • Beta版崩溃后会弹出“Report”选项,但即使选择该选项,也从未在Play控制台、Firebase控制台看到上报的崩溃记录

请问如何让Crashlytics在预发布测试之外也能接收崩溃报告?是否存在诸如「应用版本需与上传版本一致」「禁止使用VPN」「崩溃后需选择Report选项」「显示版本字符串不能含空格」等前提条件?(根据官方文档,本地构建测试也应能上报崩溃报告)

我的开发环境:

  • Android Studio Chipmunk(最新版)
  • 已更新至最新Firebase BOM

项目级build.gradle配置

buildscript {
    repositories {
        google()
        mavenCentral()
        maven {url "https://plugins.gradle.org/m2/" }
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'
        //classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        //classpath 'com.github.jk1:gradle-license-report:1.9'
        classpath 'com.github.jk1:gradle-license-report:2.0'

        classpath 'com.google.gms:google-services:4.3.13'
        // Add the Crashlytics Gradle plugin
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
    }
} ...

模块级build.gradle配置

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
    id 'com.google.firebase.crashlytics'
}
...
    repositories {
        maven { url "https://jitpack.io" }
        mavenCentral()
    }

    dependencies {
        // Import the BoM for the Firebase platform
        implementation platform('com.google.firebase:firebase-bom:30.4.0')  // Bill Of Materials
        implementation 'androidx.appcompat:appcompat:1.4.2' // this is last version compatible with Android sdk 31
        implementation 'com.google.code.gson:gson:2.8.6'
        implementation 'com.squareup.retrofit2:retrofit:2.9.0'
        implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
        implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
        implementation 'androidx.navigation:navigation-ui:2.5.1'
        implementation "androidx.lifecycle:lifecycle-process:2.5.1"
        implementation 'androidx.lifecycle:lifecycle-common-java8:2.5.1'
        implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
        implementation 'org.jetbrains:annotations:15.0'
        implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
        implementation 'androidx.preference:preference:1.2.0'
        implementation 'androidx.biometric:biometric:1.1.0'
        implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
        implementation 'org.apache.commons:commons-math3:3.6.1'
        implementation 'com.github.drawers:SpinnerDatePicker:2.1.0'
        testImplementation 'junit:junit:4.13-beta-2'
        androidTestImplementation 'androidx.test:runner:1.4.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

        implementation 'ch.qos.logback:logback-classic:1.2.10'
        implementation 'ch.qos.logback:logback-core:1.2.10'
        implementation 'org.codehaus.janino:commons-compiler:3.1.6'

        // for in-app purchases (data service subscription)
        implementation 'com.android.billingclient:billing:5.0.0'

        // for message broadcasting, diagnostics & analytics
        // When using the BoM, you don't specify versions in Firebase library dependencies
        implementation 'com.google.firebase:firebase-analytics'
        implementation 'com.google.firebase:firebase-crashlytics'
        implementation 'com.google.firebase:firebase-messaging'
    }

主Activity相关代码

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
 ...
    // Obtain the FirebaseAnalytics instance.
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
...

        // TODO remove in production
        addTestCrashButtonForCrashlytics();
...
}

private void addTestCrashButtonForCrashlytics() {
    Button crashButton = new Button(this);
    crashButton.setText("Test Crash");
    crashButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            throw new RuntimeException("Test Crash"); // Force a crash
        }
    });
}

感谢任何能帮我解决此问题的人。


内容的提问来源于stack exchange,提问作者Ellen Strnod

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 09:45:41