Reputation: 425
When I am trying to build the application I getting error as
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. com.android.builder.dexing.DexArchiveMergerException: java.util.zip.ZipException: zip file is empty
I went and cleared the JDK. i reinstalled it again but still, I am getting the error. Any have any idea about it? Thanks in advance
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.vicky.sample"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Upvotes: 2
Views: 6039
Reputation: 3662
Adding another solution after spending half a day on this. If you have legacy dependencies like citrix or something, they are stored in {user}.m2 instead of {user}.gradle. Delete this directory too if the other solutions are not working!
Upvotes: 1
Reputation: 53
If you encountered this problem while minifyEnabled true in release you should add this line to your ProGuard-rules.pro file:
-keepparameternames
Hope this helps :)
Upvotes: 1
Reputation: 355
It's a late answer but it may possibly help someone. I've had similar issue today after upgrading Android Studio to the next version and compilation failed with the reason java.util.zip.ZipException: zip file is empty. It drove me crazy for the whole day and eventually deleting gradle cashes helped to solve it.
C:\Users\{user}\.gradle\caches
Upvotes: 0
Reputation: 425
Ok I finally solved the problem i just upgraded to Android Studio 3.1 Canary 6 i came across in some thread that this problem is specific to the Android Studio 3.0.1 of intellij platform (i will try to post the thread link later!) but i can not conclude the solution because even i just tried in other thread but i did not got answer yet. And still i am trying to find answer for this thread but for now the current fix is to upgrade the android version.
Upvotes: 1