TransformException:DoubleMetaphone.class Gradle错误的重复条目

时间:2016-12-30 12:36:09

标签: android gradle duplicates dependencies build.gradle

当我尝试在Android Studio中生成已签名的APK文件时,我收到以下错误:

  

错误:任务':app:transformClassesWithJarMergingForRelease'执行失败。   com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:org / apache / commons / codec / language / DoubleMetaphone.class

我的Build.gradle如下:

android {
    compileSdkVersion 'Google Inc.:Google APIs:23'
    buildToolsVersion "23.0.2"

    //    added for unicode encoding
    compileOptions.encoding = 'windows-1251'


    defaultConfig {
        applicationId "com.app.example"
        minSdkVersion 14
        targetSdkVersion 23
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':facebookActivity')
    compile files('libs/aws-android-sdk-1.4.3-core.jar')
    compile files('libs/aws-android-sdk-1.4.3-s3.jar')
    compile files('libs/httpmime-4.1-beta1.jar')
    compile files('libs/nineoldandroids-2.4.0.jar')
    compile files('libs/universal-image-loader-1.2.1.jar')
    compile files('libs/org.apache.http.legacy.jar')
    compile 'com.google.android.gms:play-services:10.0.1'
}

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

尝试在android{}

中添加这些代码行
packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
}