1

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'

Community
  • 1
  • 1
user2648519
  • 105
  • 2
  • 10
  • Please explain in more detail what you've tried to solve the problem. Also, check that those questions also fail at `app:transformResourcesWithMergeJavaResForDebug` before attempting their solutions – OneCricketeer Oct 06 '16 at 04:43
  • Thanks for reply, I have put exclude in packageOptions in build.gradle file and also added buildTypes { release { minifyEnabled false shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { zipAlignEnabled true } } – user2648519 Oct 06 '16 at 10:42
  • Those linked questions explicitly had error messages about the META-INF folder. Yours, on the other hand, seems to point out that the AAR project that you've included is much smaller than expected – OneCricketeer Oct 06 '16 at 14:16
  • I have added details about exception – user2648519 Oct 07 '16 at 02:35
  • Hava you manage to solve this? – damienix Apr 26 '17 at 21:54
  • The .aar file I was using, was corrupted. And I found few files which are duplicate in project. To check corrupted .aar file, try to extract it by calling "jar -xvf ". If it extracts successfully then your file is not corrupted. – user2648519 Oct 13 '17 at 07:02

0 Answers0