2016-11-23 3 views
2

作成中システムのFirebaseで作成しています。私はプロジェクトをコンパイルするときしかし、それは私を与える:エラー重複したエントリ:com/google/android/gms/common/api/zze.class

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

はbuild.gradle(プロジェクト):

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

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

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

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

build.gradle(アプリ):

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "24.0.2" 
    defaultConfig { 
     applicationId "com.zihadrizkyef.belajar_facebooklogin" 
     minSdkVersion 19 
     targetSdkVersion 25 
     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(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.android.support:appcompat-v7:25.0.1' 
    compile 'com.google.firebase:firebase-core:10.0.0' 
    compile 'com.google.firebase:firebase-auth:9.8.0' 
    compile 'com.facebook.android:facebook-android-sdk:[4,5)' 
    testCompile 'junit:junit:4.12' 
} 

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

だけの提案を:firebase-authのバージョン10.0.0を使用して、25.0.0にご 'buildToolsVersion'を変更し、私はであなたは大きなライブラリが含まれていないので、あなたがここにmultiDexを必要としないと思うあなたのプロジェクト。だからあなたはそれを削除したり、コメントしたりする必要があります。 –

+0

私はそれを削除すると、アンドロイドスタジオは私にmultidexエラーを与えます。私はエラー引用符を覚えていません – zihadrizkyef

+0

うーん。あなたのプロジェクトの 'libs'ディレクトリに別のライブラリが含まれていますか? –

答えて

4

すべてのFirebaseライブラリは同じバージョンでなければなりません。

compile 'com.google.firebase:firebase-core:10.0.0' 
compile 'com.google.firebase:firebase-auth:10.0.0' 
0

私のプロジェクトでは、いくつかの重複したファイルが別のjarファイルやlibsにあります。私はappのbuild.gradleというコードをいくつか追加します:

packagingOptions { 
    exclude 'META-INF/DEPENDENCIES.txt' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INFTICE.txt' 
    exclude 'META-INFTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INFtice.txt' 
    exclude 'META-INFcense.txt' 
    exclude 'META-INF/dependencies.txt' 
    exclude 'META-INF/LGPL2.1' 
    exclude 'META-INF/MANIFEST.MF' 
    exclude 'META-INF/maven/com.google.protobuf/protobuf-java/pom.xml' 
    exclude 'META-INF/maven/com.google.protobuf/protobuf-java/pom.properties' 
} 

これは機能します。

「com/google/android/gms/common/api/zze.class」またはすべてのjarを含む他のjarファイルを含めることができます。

UMeng jarsにはprotobufが含まれていますが、私のモデルにも含まれているため、packagingOptionsのbuild.gradleにある2つのprotobuf-javaファイルを除外します。

+0

私はそのコードをどこに入れますか? btwどのジャーが複製しているのかわかりません – zihadrizkyef

0
compile 'com.android.support:appcompat-v7:25.0.1' 
compile 'com.google.firebase:firebase-core:10.0.0' 
compile ('com.google.firebase:firebase-auth:9.8.0') { 
    exclude group: 'com.google.android.gms' 
} 
compile 'com.facebook.android:facebook-android-sdk:4.+' 
compile 'com.android.support:multidex:1.0.1' 
testCompile 'junit:junit:4.12' 
関連する問題