app:TransformClasses with Jarmergingfordebug’;:java.util.zip.ZipException

app:TransformClasses with Jarmergingfordebug’;:java.util.zip.ZipException,java,android,android-studio,gradle,android-gradle-plugin,Java,Android,Android Studio,Gradle,Android Gradle Plugin,在我添加了Play Services GCM依赖项gradle之后,它就不再构建了。我在构建过程中遇到此错误 同步:好的 制作项目:好的 清洁:好的 运行:错误 应用程序:transformClassesWithJarMergingForDebug”:com.android.build.transform.api.TransformException: java.util.zip.ZipException:重复条目: android/support/annotation/AnimatorRe

在我添加了Play Services GCM依赖项gradle之后,它就不再构建了。我在构建过程中遇到此错误

  • 同步:好的
  • 制作项目:好的
  • 清洁:好的
  • 运行:错误
应用程序:transformClassesWithJarMergingForDebug”:com.android.build.transform.api.TransformException: java.util.zip.ZipException:重复条目: android/support/annotation/AnimatorRes.class

这个问题可能是图书馆之间的冲突。因此,我尝试从新添加的gradles中排除support-V4冲突。但问题依然存在

这个问题很可能是由于超过了Android设置的65K methods dex限制。所以我尝试清理项目,并从构建中的依赖项中删除一些未使用的库和方法。Gradle,或通过添加多索引支持

渐变文件:

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

android {
compileSdkVersion 22
buildToolsVersion "22.0.0"

defaultConfig {
    applicationId "com.widevision.dressnroom"
    minSdkVersion 16
    versionCode 1
    versionName "1.0"
    multiDexEnabled = true


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

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'
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

dexOptions {
    preDexLibraries = false
    incremental true
    javaMaxHeapSize "4g"
}

afterEvaluate {
    tasks.matching {
        it.name.startsWith('dex')
    }.each { dx ->
        if (dx.additionalParameters == null) {
            dx.additionalParameters = ['--multi-dex']
        } else {
            dx.additionalParameters += '--multi-dex'
        }
    }
}
}



dependencies {
compile files('libs/activeandroid-3.0.jar')
compile files('libs/android-query-full.0.25.10.jar')
compile files('libs/gson-2.2.4.jar')
compile files('libs/okhttp-2.0.0.jar')
compile files('libs/okio-1.0.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/joda-time-2.0.jar')
compile files('libs/commons-lang3-3.4.jar')
compile 'com.balysv:material-ripple:1.0.2'
compile files('libs/anjlab-iabv3-current.jar')
compile ('com.google.android.gms:play-services:8.1.0')
        {
            exclude group: 'com.android.support', module: 'support-v4'
        }

compile ('com.android.support:multidex:1.0.1')
        {
            exclude group: 'com.android.support', module: 'support-v4'
        }


}