I am facing issue while building the apk..
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/widget/ViewDragHelper$Callback.class
The Dependencies i have added is :
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 files('libs/PGSDK_v1.0.1.jar')
compile files('libs/gcm.jar')
compile files('libs/utilities.jar')
compile files('libs/volley.jar')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.moengage:moe-android-sdk:7.4.01'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
Remove this dependency compile files('libs/gcm.jar')
You already have compile 'com.google.android.gms:play-services-gcm:10.0.1'
EDIT
Internally some library depends on support-v4 with x- version so gradle link that with your project. Check which artifact having support-v4 and manually exclude support-v4 from that artifact like this.
compile ('com.android.support:appcompat-v7:25.3.1') {
exclude module: 'support-v4'
}
It's better to use group name with artifact and version to compile instead of jars if artifact is available in any repository.
Related
I have a problem when I try to generate an apk with Android Studio 2.3
I'm getting an error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/antlr/v4/runtime/ANTLRErrorListener.class
I understand that some of my dependencies must implement the same methods, but I can't figure out which one,
Here are my dependencies
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 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.graphql-java:graphql-java:2016-10-19T14-40-14'
compile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.altbeacon:android-beacon-library:2.12.2'
compile 'io.fotoapparat.fotoapparat:library:1.4.1'
testCompile 'junit:junit:4.12'
}
Thank you
You can exclude the antlr4 in the dependency with:
compile('com.graphql-java:graphql-java:2016-10-19T14-40-14') {
exclude module: 'antlr4'
}
You can find the related issues here:
https://github.com/graphql-java/graphql-java/issues/225
https://github.com/graphql-java/graphql-java/issues/254
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
I have shared graddle Image HereError:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/content/res/TypedArrayUtils.class
This error usually occurs when there is duplication of dependencies in gradle file. Check your app gradle file again, search for duplicate dependencies.
For instance, if google services of version 9.2.0 is added and another google service version for instance say maps is added with version 10.0.0 so here conflict will occur hence resulting with this error
Lİke #Techlnsect mentioned above we need to give direct import, try to remove ++ at the end of compiling element and find suitable for your work
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 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:cardview-v7:2+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:multidex:1.0.0'
}
I changed it to and problem gone
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 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:multidex:1.0.0'
}
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
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?