适用于任务':app:transformClassesWithJarMergingForDebug'

时间:2016-04-03 04:55:20

标签: android rebuild

我正在尝试将Pushy(https://pushy.me/)集成到我的应用中,以便提供更可靠的实时通知,代替GCM。

但是,在尝试运行该应用时,会出现以下错误:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/fasterxml/jackson/core/base/GeneratorBase$1.class

以下是我的build.gradle课程:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "22.0.1" // 22.0.1

    defaultConfig {
        applicationId "com.example.android.myapp2"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }

    dataBinding {
        enabled = true
    }

}

dependencies {
    compile 'com.android.support:design:23.1.0'
    compile 'com.mcxiaoke.volley:library:1.0.+'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.code.gson:gson:2.6.1'
    compile 'com.firebase:firebase-client-android:2.5.1+'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
    compile 'com.android.support:support-v4:23.1.0'
    compile 'com.android.support:recyclerview-v7:23.1.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

我试图清理,重建,但没有任何帮助。

我该如何缓解这个问题?

1 个答案:

答案 0 :(得分:3)

联系支持热线后,我只需要防止jackson库的重复引用:

configurations {
    all*.exclude group: 'com.fasterxml.jackson.core'
}

并将依赖项更改为:

dependencies {
    compile 'com.android.support:design:23.1.0'
    compile 'com.mcxiaoke.volley:library:1.0.+'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.code.gson:gson:2.6.1'
    compile 'com.firebase:firebase-client-android:2.5.1+'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
    compile 'com.android.support:support-v4:23.1.0'
    compile 'com.android.support:recyclerview-v7:23.1.0'
    compile files('libs/pushy-1.0.7.jar')     //** Specified **
}