TransformException: java.util.zip.ZipException: duplicate entry: com/activeandroid/ActiveAndroid.class - android

Please let me know what exactly require here, I can see same source is running fine in Android Studio Emulators but in third party emulators like bluestacks I can see following errors.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/activeandroid/ActiveAndroid.class
Please check my gradle dependencies here.
dependencies {
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile files('library/android-viewbadger.jar')
compile files('library/robobinding-0.8.1.jar')
compile files('library/activeandroid-3.1-SNAPSHOT.jar')
compile project(':Android-Validator')
// compile files('library/java-rt-jar-stubs-1.5.0.jar')
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.0.1'
compile ('com.android.support:appcompat-v7:25.0.1'){
exclude module: 'support-v4'
}
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.f2prateek.progressbutton:progressbutton:2.1.0#aar'
compile files('library/afreechart-0.0.4.jar')
compile 'commons-io:commons-io:+'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.google.guava:guava:16+'
compile 'joda-time:joda-time:2.9.4'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'com.sun.codemodel:codemodel:2.4.1'
compile 'org.apache.httpcomponents:httpmime:4.5.1'
compile 'ch.acra:acra:4.9.0'
compile 'org.jsoup:jsoup:1.10.2'
compile 'org.apache.commons:commons-lang3:3.4'
compile ('org.simpleframework:simple-xml:2.7.1'){
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile files('library/pdfjet-5.75.jar')
compile 'log4j:log4j:1.2.17'
compile 'com.splunk:mint-android-sdk:5.2.1'
compile 'de.mindpipe.android:android-logging-log4j:1.0.3'
compile files('library/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar')
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
}

This issue usually came when the same class is added in gradle twice.
Why you are using
compile files('library/activeandroid-3.1-SNAPSHOT.jar')
and
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
This is the reason for this.Try adding it once only and then build the gradle and run

Related

I am getting gradle error Execution failed for task

I am getting this error
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/volley/AuthFailureError.class
I attached my gradle please check and help me.
android {
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/android-async-http-1.4.4.jar')
compile files('libs/disklrucache-2.0.1.jar')
compile files('libs/google-gson.jar')
compile project(':linkedin-sdk')
compile files('libs/PGSDK_V2.0.jar')
compile 'com.android.support:support-v13:25.3.1'
compile files('libs/okhttp-1.2.1-jar-with-dependencies.jar')
compile files('libs/volley.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.razorpay:checkout:1.4.1'
compile 'com.google.android.gms:play-services-auth:9.2.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.jjoe64:graphview:4.2.0'
}
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.>
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/android/volley/AuthFailureError.class
Remove
compile files('libs/volley.jar') // From local lib also
Use
compile 'com.android.volley:volley:1.0.0'
I am using linkedin sdk,inside linkedin adk also one volley compile is
there and my app level I have one more volley dependency.
You should call volley:1.0.0 there.
Remove Below jar file from gradle
compile files('libs/volley.jar')
compile files('libs/google-gson.jar')
and compile below dependency
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.android.gms:play-services-auth:11.4.0'

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class
This is the exception I got after compiling google guava library.
Here, the issue is some other library is using the same class(issue of duplicacy)
Did all necessary things like listing all the library my project is using( ../gradlew.bat dependencies) but found no duplicate class
Below my Gradle.
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.5.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.5.0'
/*Firebase*/
compile 'com.google.firebase:firebase-messaging:11.0.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
/*Header recyclerView*/
compile 'com.karumi:headerrecyclerview:1.1.0'
testCompile 'junit:junit:4.12'
/*Custom snackBar*/
compile 'com.androidadvance:topsnackbar:1.1.1'
/*google services*/
compile 'com.google.android.gms:play-services-location:11.0.0'
compile 'com.google.android.gms:play-services:11.0.0'
/*socket io*/
compile 'com.github.nkzawa:socket.io-client:0.3.0'
/*Map utils library*/
compile 'com.google.maps.android:android-maps-utils:0.5+'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.google.guava:guava:16.0.1'
try this exclude the duplicated file by using below code in your gradle app module
android {
buildTypes {
}
packagingOptions {
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
exclude 'build-data.properties'
}
}
and try this also
compile('com.microsoft.azure:azure-mobile-services-android-sdk:2.0.2') {
exclude module: 'guava'
}

Java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class

Why am getting this error it will not occurred when I sync the Gradle but when I'm running the project I am getting this error .
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class
I don't know which dependency cause this error, My dependencies are .
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:customtabs:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:percent:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.19.0'
compile 'com.google.android.gms:play-services-auth:11.0.0'
compile 'com.google.android.gms:play-services-location:11.0.0'
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.google.android.gms:play-services-places:11.0.0'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
compile 'io.nlopez.smartlocation:library:3.3.1'
compile 'com.appeaser.sublimenavigationviewlibrary:sublimenavigationviewlibrary:0.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.afollestad:sectioned-recyclerview:0.4.1'
compile 'com.github.medyo:fancybuttons:1.8.3'
compile 'com.basgeekball:awesome-validation:2.0'
compile 'com.github.michaelye.easydialog:easydialog:1.4'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Edit
I figured it out play service dependencies causing this problem. when I'm using 10.2.6 instead of 11.0.0 app is working perfectly, I just change dependecies to
compile 'com.google.android.gms:play-services-auth:10.2.6'
compile 'com.google.android.gms:play-services-location:10.2.6'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.google.android.gms:play-services-places:10.2.6'
but I want to use latest version of play-services 11.0.0 but it gives me the above problem. How to resolve this problem? Any help would be appriciated Thanks.
Finally problem is solved. Seems like its a bug google resolved this issue in updated version.
Use play Service Version 11.0.1
In project level gradle use
classpath 'com.google.gms:google-services:3.1.0'
Sometimes, this issue happens because of including different version of play-services (or some other libraries). Have a look at app dependencies using below:
gradle app:dependencies
or if you are using Gradle wrapper
./gradlew app:dependencies
There might be some other third party library that is using an older version of library. If that is the case, exclude the older library from the third party library and include the latest one.
You can do something like this:
compile ('com.thirdpartylib.android:library-sdk:8.3.0') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.android.gms', module: 'play-services-gcm'
compile 'com.android.support:support-v4:26.0.0'
compile 'com.android.support:support-annotations:26.0.0'
compile 'com.google.android.gms:play-services-gcm:11.2.0'
}
This should resolve any duplicate entry, the main reason for the issue

TransformException duplicate entry for com/google/android/gms/measurement/AppMeasurementService.class

after the update of Android Support Repository (not sure that is related) I'm getting this error while run my application for debug:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException:
duplicate entry: com/google/android/gms/measurement/AppMeasurementService.class
I read many answers about similar exception but I could not find one the suit mine.
These are my library dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:support-v13:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:customtabs:${supportLibVersion}"
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
compile 'com.bignerdranch.android:expandablerecyclerview:2.1.1'
compile 'com.mikepenz:iconics-core:2.5.11#aar'
compile 'com.mikepenz:google-material-typeface:2.2.0.1.original#aar'
compile('com.github.afollestad.material-dialogs:core:0.8.5.8#aar') {
transitive = true
}
compile('com.github.afollestad.material-dialogs:commons:0.8.5.8#aar') {
transitive = true
}
compile "com.google.android.gms:play-services-maps:${playServicesLibVersion}"
compile "com.google.android.gms:play-services-gcm:${playServicesLibVersion}"
compile "com.google.android.gms:play-services-location:${playServicesLibVersion}"
compile "com.google.android.gms:play-services-plus:${playServicesLibVersion}"
compile "com.google.android.gms:play-services-auth:${playServicesLibVersion}"
compile "com.google.firebase:firebase-core:${playServicesLibVersion}"
compile "com.google.firebase:firebase-ads:${playServicesLibVersion}"
compile "com.google.firebase:firebase-messaging:${playServicesLibVersion}"
compile 'com.annimon:stream:1.0.8'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.soundcloud.android:android-crop:1.0.1#aar'
compile files('libs/azure/notificationhubs/notification-hubs-0.4.jar')
compile files('libs/azure/notifications/notifications-1.0.1.jar')
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.squareup.okhttp:okhttp:2.6.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.6.0'
compile 'com.google.code.gson:gson:2.6.2'
compile ('org.simpleframework:simple-xml:2.7.1') {
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'stax', module: 'stax-api'
exclude group: 'stax', module: 'stax'
}
compile 'com.facebook.conceal:conceal:1.0.1#aar'
compile 'com.facebook.android:facebook-android-sdk:4.8.1'
compile 'me.tatarka.bindingcollectionadapter:bindingcollectionadapter:1.0.1'
compile 'me.tatarka.bindingcollectionadapter:bindingcollectionadapter-recyclerview:1.0.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'jp.wasabeef:glide-transformations:1.3.1'
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
}
And these are my app dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':core')
compile "com.android.support:cardview-v7:${supportLibVersion}"
compile 'com.github.rey5137:material:1.2.2'
compile 'net.opacapp:multiline-collapsingtoolbar:1.0.0'
compile 'jp.wasabeef:recyclerview-animators:2.2.0'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
apt "org.parceler:parceler:1.0.4"
compile 'org.parceler:parceler-api:1.0.4'
compile 'com.android.support:multidex:1.0.1'
}
I know that I'm supposed to remove a dependency that cause the conflict but I don't know which one I've to remove.
Need help :)
Thanks in advance
EDIT
I've notice right now that from Android Studio, in the Project tab, inside External Libraries there is the play_services_measurement_8_3_0 that I've not included anywhere. During build I can also see this line:
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library
I've recently included the firebase library inside my project so I think that the problems is here....maybe...but I'm not able to remove it. How can I fix that?

Execution failed for task ':app:packageAllLocalVersionDebugClassesForMultiDex'

Logcat Error:
Error:Execution failed for task ':app:packageAllLocalVersionDebugClassesForMultiDex'.>java.util.zip.ZipException: duplicate entry: bolts/AggregateException.class
App Gradle Dependency:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3#aar'
compile 'com.daimajia.swipelayout:library:1.1.8#aar'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.traex.rippleeffect:library:1.3'
compile 'com.facebook.fresco:fresco:0.9.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile project(':floating_button_library')
compile 'com.facebook.android:facebook-android-sdk:4.10.0'
}
After adding the dependency for Facebook SDK the build throws an Exception
suggest me an answer thanks..
EDIT:
SOLVED THE ERROR
Now they split bolts-android into bolts-applinks and bolts-tasks .so you need exclude both from the gradle build
compile ('com.facebook.android:facebook-android-sdk:4.10.0'){
exclude group: 'com.parse.bolts',
module: 'bolts-tasks'
exclude group: 'com.parse.bolts',
module: 'bolts-applinks';}
This works perfectly for me !!!!
there were two DIFFERENT versions of it conflicting. the facebooksdk
comes with bolts-android-1.1.x and appcompatv7 comes with 1.1.x.
so add below line,
compile ('com.facebook.android:facebook-android-sdk:4.10.0'){
exclude module: 'bolts-android'
exclude module: 'support-v4'
}

Categories

Resources