I have an .aar file in my app module libs folder and then I Synchronize with Android in android studio it builds SUCCESSFULL, but if I try to BUILD APK then it shows following error:
FAILURE: Build failed with an exception.
Exception failed for task ':app:transformResourcesWithMergeJavaResForDebug'. > java.util.zip.ZipException: invalid entry size (expected 3028547021 but got 599 bytes)
Exception detail
Caused by: java.util.zip.ZipException: invalid entry size (expected 3018547021 but got 599 bytes) at com.android.build.gradle.internal.transforms.JarMerger.addJar(JarMerger.java:147) at com.android.build.gradle.internal.transforms.MergeJavaResourcesTransform.copyIntoJar(MergeJavaResourcesTransform.java:464) at com.android.build.gradle.internal.transforms.MergeJavaResourcesTransform.transform(MergeJavaResourcesTransform.java:335) at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:151) at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:148) at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
I have applied tricks given on different answers in stackoverflow but non be helpful.
My gradle file looks like this:
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'
}
I have applied following tricks from stackoverflow: Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug' Gradle build error, Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'