生成签名APK时出错:重复条目:android / support / v7 / util / ThreadUtil $

时间:2017-01-06 21:18:20

标签: android gradle duplicates kinvey

我已经花费了无数个小时,阅读了大量的SO帖子,但似乎无法找到解决方案。当我生成签名的APK时,我会继续

  

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

     

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / support / v7 / util / ThreadUtil $ BackgroundCallback.class

我已尝试删除不同的JAR以查看可能是重复的内容,但无济于事。 android-support-v7-recyclerview-23.1.1.jarseemed就像是我的罪魁祸首,所以我删除它并且不再得到错误。但是,相反,我的应用程序开始花费很长时间来生成,CPU使用率达到350%,然后使用" OutOfMemory"例外。

这是我的build.gradle文件。

apply plugin: 'com.android.application'
repositories {
    mavenCentral()
    maven(){
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
    flatDir {
        dirs 'libs'
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.me.myapp"
        minSdkVersion 13
        targetSdkVersion 25
        multiDexEnabled true
    }

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

dependencies {
    compile 'com.android.support:support-v4:25.1.0'
    compile 'com.google.android.gms:play-services-analytics:10.0.1'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.google.android.gms:play-services-ads:10.0.1'
    compile 'com.google.android.gms:play-services-location:10.0.1'
    compile files('libs/android-support-v7-recyclerview-23.1.1.jar')
    compile files('libs/applovin-6.3.0.jar')
    compile files('libs/appodeal-1.15.8.jar')
    compile files('libs/chartboost-6.5.1.jar')
    compile files('libs/flurry-analytics-6.5.0.jar')
    compile files('libs/google-http-client-1.19.0.jar')
    compile files('libs/google-http-client-android-1.19.0.jar')
    compile files('libs/google-http-client-gson-1.19.0.jar')
    compile files('libs/google-http-client-jackson2-1.19.0.jar')
    compile files('libs/gson-2.1.jar')
    compile files('libs/guava-18.0.jar')
    compile files('libs/jackson-core-2.1.3.jar')
    compile files('libs/java-api-core-2.10.10.jar')
    compile files('libs/kinvey-android-2.10.10.jar')
    compile files('libs/my-target-4.5.10.jar')
    compile files('libs/unity-ads-2.0.4.jar')
    compile files('libs/yandex-metrica-2.51.jar')
    compile project(':cheetah-mobile-3.4.7')
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.github.dexafree:materiallist:3.2.1'
    compile 'jp.wasabeef:recyclerview-animators:2.0.1'
    compile ('com.github.worker8:tourguide:1.0.17-SNAPSHOT@aar'){
        transitive=true
    }
}
apply plugin: 'com.google.gms.google-services'

提前谢谢!

1 个答案:

答案 0 :(得分:0)

我很开心!它终于修复了!

我删除了' libs / android-support-v7-recyclerview-23.1.1.jar'从我的gradle中添加下面的行" android"封闭我的build.gradle。

dexOptions { 
    javaMaxHeapSize "4g" 
}

我从this post得到答案。