任务执行失败:app:transformClassesWithJarMergingForRelease

时间:2017-05-31 23:15:30

标签: java android android-studio

我有这个错误:

  

错误:任务执行失败   ':应用程序:transformClassesWithJarMergingForRelease'。   com.android.build.api.transform.TransformException:   java.util.zip.ZipException:重复条目:   COM /机器人/自动售货机/计费/ IInAppBillingService $ $存根Proxy.class

我的构建格斗是

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '25.0.0'
    defaultConfig {
            applicationId "com.kiry32.root.quizaia"
            minSdkVersion 16
            targetSdkVersion 23
            versionCode 13
            versionName "1.3.5"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 
                'proguard-rules.pro'
            }
        }
        productFlavors {
        }
    }

    allprojects {
        repositories {
        jcenter()
        maven { url "http://dl.appnext.com/" }
    }
}


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

    compile 'com.android.support:design:24.0.0'
    compile 'com.google.android.gms:play-services:10.2.0'
    compile 'com.google.firebase:firebase-ads:10.2.0'
    compile 'com.anjlab.android.iab.v3:library:1.0.+'
    compile 'com.appnext.sdk:ads:2.+' // Mandatory
    compile 'com.google.android.gms:play-services-basement:10.2.0' // Mandatory
    compile 'com.google.android.gms:play-services-location:10.2.0'
    compile 'com.android.support:multidex:1.0.1'
}

和其他爷爷

// Top-level build file where you can add configuration options common to 
all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2+'
        classpath 'com.google.gms:google-services:3.1.0+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

如何修复此错误?在我放置appnext广告之前,它工作了我的apk

提前致谢!!!

2 个答案:

答案 0 :(得分:0)

这种情况正在发生,因为appnext里面还有谷歌播放服务库。 去掉 编译'com.google.android.gms:play-services:10.2.0' 并且只使用您真正需要的Google Play服务部分。就像你已经添加

一样
compile 'com.google.android.gms:play-services-basement:10.2.0' // Mandatory
compile 'com.google.android.gms:play-services-location:10.2.0'

答案 1 :(得分:0)

我改变了你的说法,但它继续给我同样的错误  Grandle是:

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'



android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
    applicationId "com.kiry32.root.quizaia"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 13
    versionName "1.3.5"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
productFlavors {
}
}

allprojects {
repositories {
    jcenter()
    maven { url "http://dl.appnext.com/" }
}
}


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


compile 'com.android.support:design:25.3.1'

compile 'com.google.firebase:firebase-ads:10.2.0'
compile 'com.anjlab.android.iab.v3:library:1.0.+'
compile 'com.appnext.sdk:ads:2.+' // Mandatory
compile 'com.google.android.gms:play-services-basement:10.2.0' // Mandatory
compile 'com.google.android.gms:play-services-location:10.2.0'
compile 'com.android.support:multidex:1.0.1'

}