【问题标题】:Can not see crashlytics看不到 crashlytics
【发布时间】:2021-12-10 23:35:59
【问题描述】:

我看不到 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")
    }
}

【问题讨论】:

    标签: android firebase crashlytics


    【解决方案1】:

    我认为您错过了在项目和应用级别 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 一步一步地进行操作

    【讨论】:

    • 我已经添加了它仍然无法正常工作的两条线。你能提供任何其他解决方案吗?
    • 您是否按照我链接的文档中的方式进行了所有操作?您还可以为 crashlytics 启用调试日志记录,以查看它是否正在发送报告。见firebase.google.com/docs/crashlytics/…
    • 是的,现在工作正常。
    猜你喜欢
    • 2019-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-12
    • 2021-02-15
    • 1970-01-01
    相关资源
    最近更新 更多