【问题标题】:I cannot get firebase crash report working on Android我无法在 Android 上获得 Firebase 崩溃报告
【发布时间】:2016-10-29 22:14:34
【问题描述】:

这是我的build.gradle 文件。

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.1'
        classpath 'com.google.gms:google-services:2.1.2'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

这是另一个

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"
    defaultConfig {
        applicationId 'com.example.app'
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    testCompile 'junit:junit:4.12'
    compile 'com.squareup.okhttp:okhttp:2.5.0'
    compile 'com.android.support:recyclerview-v7:24.2.1'
    compile 'com.android.support:cardview-v7:24.2.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    //compile 'com.google.firebase:firebase-core:9.8.0'
    compile 'com.google.firebase:firebase-ads:9.8.0'
    compile 'com.google.firebase:firebase-crash:9.8.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
    compile project(path: ':standOut')
}

apply plugin: 'com.google.gms.google-services'

Gradle Sync 正常运行,但当我尝试运行应用程序时出现以下错误

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/measurement/AppMeasurementService.class

如果我将行 classpath 'com.google.gms:google-services:2.1.2' 更改为 classpath 'com.google.gms:google-services:3.0.0' 并同步 gradle 文件,我可以运行该应用程序,当我在真实设备上运行它时,我会收到此错误。

E/FirebaseCrash: Failed to initialize crash reporting: com.google.android.gms.internal.zztl$zza: No acceptable module found. Local version is 0 and remote version is 0.

稍后当我故意使我的应用程序崩溃时,我没有收到任何崩溃报告。但是当我在三星 Galaxy S3 Mini 上运行相同的应用程序并崩溃我的应用程序时,我确实收到了崩溃报告。

在第一台设备上播放服务版本是 9.4,在三星上是 9.8。 为什么当我使用 3.0.0 版的 google services 插件时,它在三星上运行而在其他设备上不运行(我试图在另外两台设备上运行该应用程序,但在其中任何一台上都不起作用)?

为什么我在使用插件版本 2.1.2 时会收到此 duplicate entry 错误? 另外,我检查了 jcenter 上的插件版本,2.1.2 版本的日期为 2016 年 6 月 3 日,3.0.0 的日期为 2016 年 5 月 18 日 (https://bintray.com/android/android-tools/com.google.gms.google-services)。那么,哪个版本是最新的,我应该使用哪个版本?

你认为我需要这条线compile 'com.google.firebase:firebase-core:9.8.0'。我试着用它和不用它,它似乎没有任何区别。

【问题讨论】:

标签: android gradle firebase firebase-crash-reporting


【解决方案1】:

事实证明,设备上的google play services 版本不能低于使用的库版本。谷歌服务插件下载了 9.8 版。在三星上我有 9.8 版并且崩溃报告工作,但在其他设备上我有 9.4 版并且它没有工作。恕我直言,这是错误的,因为这意味着我不会从 google play services 版本低于 9.8 的用户那里收到崩溃报告。

我试图找到一种方法使 Firebase 崩溃报告与插件版本 2.1.2 一起工作,因为我无法做到这一点,我使用了版本 3.0.0。看来3.0.0版本是要走的路,我只是想知道为什么最新版本是2.1.2。

当我切换到版本 3.0.0 并将设备上的播放服务更新到版本 9.8 时,一切正常。

【讨论】:

    猜你喜欢
    • 2012-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-03
    相关资源
    最近更新 更多