com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com / google / android / gms / internal / zzbn.class

时间:2016-06-09 06:23:21

标签: android firebase

将firebase sdk添加到gradle面对下面的问题。

错误:任务':app:transformClassesWithJarMergingForDebug'执行失败。

  

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com / google / android / gms / internal / zzbn.class

请帮助!!

This is the APP gradle file 

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.fernandocejas.frodo'
apply plugin: 'realm-android'
apply plugin: 'com.neenbedankt.android-apt'


android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId "com.bt.bms"
        minSdkVersion 16
        targetSdkVersion 23
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        versionCode 6
        versionName "0.0.11"
        multiDexEnabled true

        // Following line of code added to provide support for blurring image using renderscript
        renderscriptTargetApi 16
        renderscriptSupportModeEnabled true
    }

    signingConfigs {
        bms_debug_config {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
            storeFile file('bms_new_app_debug.keystore')
            storePassword 'android'
        }
    }

    packagingOptions {
        exclude 'APK LICENSE.txt'
        exclude 'LICENSE.txt'
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    buildTypes {
//        debug {
//            applicationIdSuffix ".debug"
//            minifyEnabled false
//            debuggable true
//        }
        release {
            minifyEnabled false
            proguardFiles 'proguard.cfg'
        }

        debug {
            signingConfig signingConfigs.bms_debug_config
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    lintOptions {

        checkReleaseBuilds true

    }
    defaultPublishConfig "debug"

    repositories {

        jcenter()

        maven {url = "https://oss.sonatype.org/content/repositories/snapshots/" }
        flatDir {
            dirs 'libs'
        }
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "8g"
    }
}

String getJavaHome(String version) {
    def stdout = new ByteArrayOutputStream()
    exec {
        commandLine "/usr/libexec/java_home", "-v", version
        standardOutput = stdout;
    }
    return stdout.toString().trim()
}

retrolambda {
    //jvmArgs '-noverify'
    jdk System.getenv('JAVA8_HOME') ?: getJavaHome("1.8")
    oldJdk System.getenv('JAVA7_HOME') ?: getJavaHome("1.7")
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':common')
    compile project(':domain')
    compile project(':api')
    apt project(':compiler')

    // Times Square Library for calendar
    compile project(':timessquare')

    // App Modules
    compile(name: 'app-models', ext: 'aar')
    compile(name: 'app-network', ext: 'aar')
    compile(name: 'app-error', ext: 'aar')

    // Android support libraries
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.android.support:percent:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support:palette-v7:23.4.0'

    //Play Services Location and Map
    compile 'com.google.android.gms:play-services-location:9.0.2'


    // For G+ login
    compile 'com.google.android.gms:play-services-auth:9.0.2'
    compile 'com.google.android.gms:play-services-plus:9.0.2'

    // Facebook
    compile ('com.facebook.android:facebook-android-sdk:4.7.0'){
        exclude group: 'com.google.android.gms'
    }

    // For Clever Tap
    compile 'com.clevertap.android:clevertap-android-sdk:2.0.5'


    // Espresso Related Dependencies
    compile 'com.android.support.test.espresso:espresso-idling-resource:2.2'
    testCompile 'com.android.support.test:testing-support-lib:0.1'
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2') {
        // Necessary if your app targets Marshmallow (since Espresso hasn't moved to Marshmallow yet)
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    androidTestCompile('com.android.support.test:runner:0.3') {
        // Necessary if your app targets Marshmallow (since the test runner hasn't moved to Marshmallow yet)
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') {
        // Necessary to avoid version conflicts
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude module: 'recyclerview-v7'
    }
    androidTestCompile('com.android.support.test.espresso:espresso-intents:2.2') {
        exclude group: 'com.android.support', module: 'support-annotations'
    }

    // Retrofit
    compile 'com.squareup.retrofit:retrofit:2.0.0-beta4'
    compile 'com.squareup.okhttp:okhttp:2.4.0'
    compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
    compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'

    // Reactive x
    compile 'io.reactivex:rxandroid:1.0.1'
    compile 'javax.inject:javax.inject:1'

    // Picasso
    compile 'com.squareup.picasso:picasso:2.4.0'

    // Butterknife
    compile 'com.jakewharton:butterknife:7.0.1'

    // Dagger 2 dependencies
    apt 'com.google.dagger:dagger-compiler:2.0'
    compile 'com.google.dagger:dagger:2.0'

    // Crashlytics
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }

    // Anotation
    compile 'javax.annotation:javax.annotation-api:1.2'

    // Other
    compile 'com.alexvasilkov:foldable-layout:1.0.1'
    compile 'com.ms-square:expandableTextView:0.1.4'
    compile 'com.mikhaellopez:circularimageview:2.0.1'
    compile 'com.makeramen:roundedimageview:2.2.1'

    // For Multidex
    compile 'com.android.support:multidex:1.0.1'

    //For Bottom Sheet
    compile 'com.flipboard:bottomsheet-core:1.5.0'
    compile 'com.flipboard:bottomsheet-commons:1.5.0'

    // For Juspay
    compile('in.juspay:godel:0.6.7') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
    }

    // For mockito
    compile 'org.mockito:mockito-all:2.0.2-beta'

    // Parceler
    compile 'org.parceler:parceler-api:1.0.4'
    apt 'org.parceler:parceler:1.0.4'

    // Expandable Recycler View
    compile 'com.github.grennis:ExpandableRecyclerView:0.9.3'

    // For JW Player
    compile project(':jwplayer-android-sdk-2.1.1+142')
    compile 'com.google.android.libraries.cast.companionlibrary:ccl:2.8.3'

    //Sectioned RecyclerView
    compile 'eu.davidea:flexible-adapter:5.0.0-b6'


    compile 'jp.wasabeef:recyclerview-animators:2.2.3'

    debugCompile 'com.github.promeg:xlog-compiler:2.1.1' // ~6kB
    debugCompile 'com.github.promeg:xlog-android:2.1.1' // ~150kB

    releaseCompile 'com.github.promeg:xlog-android-idle:2.1.1' // ~5kB

    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
    testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'

    // For Firebase
    compile 'com.google.firebase:firebase-core:9.0.2'
    compile 'com.google.firebase:firebase-config:9.0.2'
}


// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:8)

只需执行命令 - ./gradlew :app:dependencies,然后查看您使用任何其他版本的google play服务在内部使用的库。如果是,则删除或更新这些库。