Reputation: 7368
app/build.gradle
Previously this same project works fine with android studio 1.5 but after updating android studio 2.1.1 failed to build apk file Error Message: Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/objectweb/asm/AnnotationVisitor.class
And incase of trying to build release apk the Error is: Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/objectweb/asm/commons/AdviceAdapter.class
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
// generatedDensities = []
applicationId "com.view9.lacuna"
minSdkVersion 15
targetSdkVersion 23
versionCode 3
versionName "3.0"
multiDexEnabled true
signingConfig signingConfigs.newSigningConfig
}
dexOptions {
javaMaxHeapSize "4g"
jumboMode = true
incremental true
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
signingConfig signingConfigs.newSigningConfig
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}
}
packagingOptions {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/BCKEY.DSA'
exclude 'AUTHORS'
exclude 'META-INF/BCKEY.SF'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
// set to true to turn off analysis progress reporting by lint
quiet false
// if true, stop the gradle build if errors are found
abortOnError true
// if true, only report errors
ignoreWarnings false
// turn off checking the given issue id's
disable 'TypographyFractions', 'TypographyQuotes'
// if true, generate a text report of issues (false by default)
textReport true
}
productFlavors {
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.tools.build:gradle:2.0.0'
compile('com.android.support:appcompat-v7:23.0.0') {
exclude module: 'support-v4'
}
compile 'com.google.android.gms:play-services:9.0.2'
compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'fr.baloomba:viewpagerindicator:2.4.2'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.github.clans:fab:1.5.5'
compile 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
compile 'commons-validator:commons-validator:1.4.0'
compile 'it.neokree:MaterialTabs:0.11'
compile 'se.emilsjolander:StickyScrollViewItems:1.1.0'
compile('org.apache.httpcomponents:httpmime:4.4.1') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile('com.github.afollestad.material-dialogs:core:0.8.5.7@aar') {
transitive = true
}
compile 'com.squareup:otto:1.3.5'
compile 'com.android.support:multidex:1.0.1'
}
Upvotes: 2
Views: 1282
Reputation: 2992
I got same problem when I converted a java class into kotlin class. I guess that the reason is that there are some old x.class file is left in the build folder.
You can search the class AdviceAdapter.class in your computer. Then delete all of them when you find them. It should works afterwards.
Upvotes: 0
Reputation: 911
I struggled with this one for a few days as well, same exact error word-for-word. I went through and read all of the answers I could find and kept adding things to my gradle file but nothing seemed to work. So, I went the other way and simplified my problem.
1.) Started with a fresh module with nothing inside except what Android Studio adds at creation time. Debugged the app and built a signed apk. This would become my baseline.
2.) Begin adding the libraries that I needed one by one, debugging to device and creating a signed apk after each one. The basic premise is that since the baseline debugged and built just fine, any library that breaks that ability is the culprit.
3.) Finally came to the culprit in my case:
compile 'com.google.gms:google-services:2.1.2'
With this line included the app would debug but would not build a signed release apk, so I deleted the line and tried again and it worked as expected.
After testing with this configuration it doesn't appear I needed it, don't why it was there if it wasn't needed but this is what worked for me. Obviously, you won't have this same exact issue but I'd venture that it has something to do with a google library. Hope this helps!
Upvotes: 0