2016-08-22 2 views
0

私のプロジェクトを実行しようとするたびに、この問題が発生しています。私はこのエラーを取得しています
:ここZipExcepton:重複するエントリ:com/google/android/gms/internal/zzpi.class

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

は私のビルドスクリプトです:

buildscript { 
    repositories { 
     maven { url 'https://maven.fabric.io/public' } 
    } 
    dependencies { 
     // The Fabric Gradle plugin uses an open ended version to react 
     // quickly to Android tooling updates 
     classpath 'io.fabric.tools:gradle:1.15.2' 
    } 
} 
apply plugin: 'com.android.application' 
//Put Fabric plugin after Android plugin 

repositories { 
    maven { url 'https://maven.fabric.io/public' } 
} 


dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile files('libs/commons-collections4-4.0.jar') 
    compile files('libs/YouTubeAndroidPlayerApi.jar') 
    compile files('libs/graphview-3.1.jar') 
    testCompile 'junit:junit:4.12' 
    compile project(':progresslibrary') 
    compile files('libs/gson-2.6.2.jar') 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.2' 
    apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.2' 



    compile 'com.android.support:multidex:1.0.0' 
    compile 'com.hrules:charter:1.4.0' 
    compile 'com.github.hotchemi:permissionsdispatcher:2.1.2' 
    //noinspection GradleCompatible 
    compile 'com.google.android.gms:play-services-analytics:8.4.0' 
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.15' 
    compile 'com.android.support:multidex:1.0.0' 
    compile 'com.hrules:charter:1.4.0' 
    compile 'com.google.android.gms:play-services-analytics:8.4.0' 
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.15' 
    compile 'com.github.hotchemi:permissionsdispatcher:2.1.2' 
    compile 'com.amazonaws:aws-android-sdk-core:2.+' 
    compile 'com.amazonaws:aws-android-sdk-s3:2.+' 
    compile 'eu.the4thfloor.volley:com.android.volley:2015.05.28' 
    compile 'com.facebook.android:facebook-android-sdk:4.0.0' 
    compile 'com.snappydb:snappydb-lib:0.5.2' 
    compile 'com.google.android.gms:play-services-auth:9.4.0' 
    compile 'com.google.android.gms:play-services-plus:8.4.0' 
    compile 'com.google.android.gms:play-services-gcm:9.4.0' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'com.google.android.gms:play-services-location:8.4.0' 
    compile 'com.wdullaer:materialdatetimepicker:2.2.0' 
    compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2' 
    compile 'com.shamanland:fab:0.0.8' 
    compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0' 
    compile 'com.android.support:design:23.2.0' 
    compile 'com.android.support:support-v4:23.2.0' 
    compile 'com.android.support:recyclerview-v7:23.2.0' 
    compile 'com.android.support:cardview-v7:23.2.0' 
    compile 'org.jsoup:jsoup:1.9.1' 
    compile 'com.flurry.android:analytics:6.2.0' 
    compile 'com.google.android.gms:play-services-fitness:8.4.0' 
    compile 'com.google.android.gms:play-services-appindexing:8.4.0' 
    compile 'com.github.danielemaddaluno.androidupdatechecker:library:1.0.2' 
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1' 
} 

android { 
    packagingOptions { 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/LICENSE.txt' 
    } 
} 
apply plugin: 'build-announcements' 

私が言うことができ、一目で私のビルドスクリプト

+0

。そこにも重複する行があります... –

+0

問題はGoogle Playサービスの1つであると言えます。 –

+0

@ cricket_007どうすれば修正できますか? –

答えて

0

と間違っているものを私に教えてくださいその問題はGoogle Playサービスに存在します。そして、私はこれらすべてが同じバージョンである必要があると推測します(ここでは同じバージョンでグループ化されています)。

compile 'com.google.android.gms:play-services-analytics:8.4.0' 
compile 'com.google.android.gms:play-services-plus:8.4.0' 
compile 'com.google.android.gms:play-services-location:8.4.0' 
compile 'com.google.android.gms:play-services-fitness:8.4.0' 
compile 'com.google.android.gms:play-services-appindexing:8.4.0' 

compile 'com.google.android.gms:play-services-auth:9.4.0' 
compile 'com.google.android.gms:play-services-gcm:9.4.0' 

は効率的にそれを行うためには、あなたは、一貫性のあるバージョン番号を維持するためにあなたにGradleのファイルをextブロックを定義することができます。

追加注:この行compile fileTree(include: ['*.jar'], dir: 'libs') ...したがって、これらの行は無意味であり、あなたは、エラーが発生した場所を特定しようとしながら、あなたがそれらを削除することができ、libs/ディレクトリ内すべて JARファイルをコンパイルすると言います。

compile files('libs/commons-collections4-4.0.jar') 
compile files('libs/YouTubeAndroidPlayerApi.jar') 
compile files('libs/graphview-3.1.jar') 
compile files('libs/gson-2.6.2.jar') 

サンプルあなたが道(アプリ開発のアンチパターンである)あまりにも多くの依存関係を含めているbuild.gradle

ext { 
    // Variables to keep libraries consistent 
    supportLibrary = "23.2.0" 
    googlePlayServicesVersion = '9.4.0' 

    // Support Libraries dependencies 
    supportDependencies = [ 
      design   :   "com.android.support:design:${supportLibrary}", 
      recyclerView  :   "com.android.support:recyclerview-v7:${supportLibrary}", 
      cardView   :   "com.android.support:cardview-v7:${supportLibrary}", 
      appCompatV7  :   "com.android.support:appcompat-v7:${supportLibrary}" 
    ] 

    googlePlayServicesDepends = [ 
      analytics : "com.google.android.gms:play-services-analytics:${googlePlayServicesVersion}" 
      plus  : "com.google.android.gms:play-services-plus:${googlePlayServicesVersion}" 
      location : "com.google.android.gms:play-services-location:${googlePlayServicesVersion}" 
      fitness  : "com.google.android.gms:play-services-fitness:${googlePlayServicesVersion}" 
      appindexing : "com.google.android.gms:play-services-appindexing:${googlePlayServicesVersion}" 
      auth  : "com.google.android.gms:play-services-auth:${googlePlayServicesVersion}" 
      gcm   : "com.google.android.gms:play-services-gcm:${googlePlayServicesVersion}" 
    ] 

} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 

    // compile supportDependencies.appCompatV7 
    // compile supportDependencies.recyclerView 

    // recommended - includes those above 
    compile supportDependencies.design 

    // extras 
    compile supportDependencies.cardView 

    // The correct Volley library 
    compile 'com.android.volley:volley:1.0.0' 

    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile "com.google.code.gson:gson:2.6.2" 

    // Google Play Services 
    compile googlePlayServicesDepends.location 
    // TODO: Add others 

} 
関連する問題