2016-10-29 15 views
2

ここに私のbuild.gradleファイルがあります。ここでAndroidベースのfirebaseクラッシュレポートを取得できません

// 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 
} 

は、別の1

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の同期が正常になりますが、私はアプリを実行しようとすると、私はラインclasspath 'com.google.gms:google-services:2.1.2'を変更した場合、私は次のようなエラー

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: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. 

後で私のアプリをクラッシュさせるために、私はクラッシュレポートを取得しません。しかし、私はサムスンギャラクシーS3ミニで同じアプリを実行し、私のアプリをクラッシュすると、クラッシュレポートを取得します。

最初のデバイスの再生サービスのバージョンでは9.4、Samsungでは9.8です。 Googleサービスプラグインのバージョン3.0.0を使用すると、サムスンで動作し、他のデバイスでは動作しません(他の2台のデバイスでアプリを実行しようとしましたが、いずれかで動作しませんでした)。

プラグインバージョン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'私はそれと一緒にやろうとしましたが、何の違いもないようです。

+0

[この動画](https://www.youtube.com/watch?v=DOJ2BfZ5lak)もチェックできます。 –

答えて

1

デバイスのgoogle play servicesバージョンは、使用されるライブラリのバージョンよりも低くなることはありません。 Googleサービスプラグインがバージョン9.8をダウンロードしました。サムスンではバージョン9.8とクラッシュレポート機能がありますが、他のデバイスにはバージョン9.4があり、動作しませんでした。 IMHOそれは間違っている、それは私がgoogle play servicesバージョン9.8より低いユーザーからのクラッシュレポートを取得しないことを意味するためです。

プラグインバージョン2.1.2でfirebaseクラッシュレポートを作成する方法を見つけようとしましたが、私はバージョン3.0.0を使用できませんでした。それはバージョン3.0.0のように見える、私はちょうど最新バージョンが2.1.2であるのだろうかと思う方法です。

私がバージョン3.0.0に切り替えて、デバイス上のプレイサービスをバージョン9.8に更新したので、すべてが機能しました。

関連する問題