任务':app:transformResourcesWithMergeJavaResForDebug'的异常失败。 > java.util.zip.ZipException:条目大小无效

时间:2016-10-06 04:41:40

标签: android android-gradle aar

我的应用程序模块libs文件夹中有一个.aar文件然后我在android studio中与Android同步它构建了SUCCESSFULL,但是如果我尝试构建APK那么它会显示以下错误:

  

失败:构建因异常而失败。

     

任务':app:transformResourcesWithMergeJavaResForDebug'的异常失败。 > java.util.zip.ZipException:条目大小无效(预期为3028547021但有599字节)

例外细节

  

引起:java.util.zip.ZipException:条目大小无效(预期3018547021,但得到599字节)           在com.android.build.gradle.internal.transforms.JarMerger.addJar(JarMerger.java:147)           在com.android.build.gradle.internal.transforms.MergeJavaResourcesTransform.copyIntoJar(MergeJavaResourcesTransform.java:464)           在com.android.build.gradle.internal.transforms.MergeJavaResourcesTransform.transform(MergeJavaResourcesTransform.java:335)           在com.android.build.gradle.internal.pipeline.TransformTask $ 2.call(TransformTask.java:151)           在com.android.build.gradle.internal.pipeline.TransformTask $ 2.call(TransformTask.java:148)           在com.android.builder.profile.ThreadRecorder $ 1.record(ThreadRecorder.java:55)

我在stackoverflow中应用了不同答案的技巧但没有帮助。

我的gradle文件如下所示:

 packagingOptions {
    exclude 'META-INF/NOTICE' // will not include NOTICE file
    exclude 'META-INF/LICENSE' // will not include LICENSE file
    // as noted by @Vishnuvathsan you may also need to include
    // variations on the file name. It depends on your dependencies.
    // Some other common variations on notice and license file names
    exclude 'META-INF/notice'
    //exclude 'META-INF/notice.txt'
    exclude 'META-INF/license'
    //  exclude 'META-INF/license.txt'
}



buildTypes {
    release {
        minifyEnabled false
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        zipAlignEnabled true
    }
}
dependencies {
compile(name: 'mycomponent-release', ext: 'aar')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'

}

我已经从stackoverflow应用了以下技巧: Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug' Gradle build error, Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'

0 个答案:

没有答案