看不到 crashlytics

Can not see crashlytics

我看不到 crashlytics。我的 build.gradle 文件中有这个。不确定,我已经完成了他们所说的所有实践,并在为我的项目设置 firebase 时从文档中复制粘贴了确切的 google-service.json 文件。任何人都可以看到为什么它不起作用谢谢!

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 31

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdk 21
        targetSdk 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.6.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation platform('com.google.firebase:firebase-bom:28.4.2')
    implementation 'com.google.firebase:firebase-analytics'
}

我的项目级别 build.gradle 文件。

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
        classpath 'com.google.gms:google-services:4.3.10'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}


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

我检查了在 firebase 控制台中启用的 crashlytics 仪表板。仍然没有捕获到崩溃。我在 android

中使用运行时异常导致崩溃
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        throw RuntimeException("Test Crash")
    }
}

我认为您错过了在项目和应用程序级别应用插件的部分 build.gradle.kts(文档中的第 3 步)

build.gradle.kts(project)
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'

build.gradle.kts(app)
apply plugin: 'com.google.firebase.crashlytics'

您可以通过文档一步步完成 here