I have to integrate paytabs payment gateway. After integrating their sdk module, the application not builds & app gets an error. My app gradle has below dependency.
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.afollestad.material-dialogs:core:0.9.1.0'
compile 'com.kyleduo.switchbutton:library:1.4.4'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile project(':PayTabs_SDK_SRC')
}
The Error looks like:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: okhttp3/Address.class
Update:
If i remove below two dependency i don't get any error. But must have to use this
retrofit dependence. Any Idea?
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
Look, PayTabs SDK includes
com.squareup.okhttp3(version 3.5.0) and com.squareup.retrofit2:retrofit:2.2.0 uses okhttp3(version 3.6.0) which confused Gradle and generates a dexException(duplicate files exception).
To solve this problem you need to exclude one of okhttp3 version. Replace these below lines in build.gradle file.
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
With these lines of code:
compile ('com.squareup.retrofit2:retrofit:2.2.0'){
exclude group: "com.squareup.okhttp3"
}
compile ('com.squareup.retrofit2:converter-gson:2.2.0'){
exclude group: "com.squareup.okhttp3"
}
Hope it will work.
Related
I am getting the below error all of a sudden. The app was running fine till morning. Since then I have been getting this. I tried loading older commits from Git, however I am getting the same issue now. I can see that there's a duplicate entry of some class, but it is not very clear where. I have checked all of my libraries to locate the issue but in vain. Please help
Error:Execution failed for task
':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [C:\Users\Bluetie Backup 3
i5\Downloads\Bluetie_Android_NewDesign-
Development\Bluetie_Android_NewDesign-Development\BlueTieAndroid-
master\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't
read [C:\Users\Bluetie Backup 3 i5\.gradle\caches\transforms-1\files-
1.1\support-core-ui-27.1.0.aar\781c80d72f0634c3cfc30b7ab8014102\jars\classes.jar(;;;;;;**.class)]
(Duplicate zip entry[classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))`
I have used a lot of Libraries as my app is very UI centric.
Here's the build.gradle file
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 project(':rtp')
compile project(':pageIndicator')
compile files('libs/linkedin-j-android.jar')
//compile files('libs/commons-codec-1.3.jar')
//compile files('libs/signpost-core-1.2.1.1.jar')
compile project(':imagepicker')
compile project(':swipflingview')
compile project(':linkedin-sdk')
compile 'com.android.support:multidex:1.0.2'
//noinspection GradleCompatible
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.firebase:firebase-crash:11.0.2'
/* compile 'com.google.firebase:firebase-auth:11.0.2'*/
compile 'com.google.android.gms:play-services-analytics:11.0.2'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
/*compile 'com.google.android.gms:play-services-ads:11.0.2'*/
compile 'com.google.android.gms:play-services-auth:11.0.2'
/* compile 'com.google.android.gms:play-services-gcm:11.0.2'*/
compile 'com.google.android.gms:play-services-places:11.0.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okio:okio:1.0.1'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:design:26.1.0'
compile ('com.facebook.android:facebook-android-sdk:4.6.0'){
exclude module: 'support-v4'
}
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.yalantis:ucrop:2.2.0'
compile 'com.appyvet:materialrangebar:1.3'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.jsibbold:zoomage:1.1.0'
compile 'com.michaelmuenzer.android:ScrollableNumberPicker:0.2.2'
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
compile ('com.nineoldandroids:library:2.4.0'){
exclude module: 'support-v4'
}
compile 'uk.co.samuelwall:material-tap-target-prompt:1.1.4'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.android.support:percent:26.1.0'
compile('com.github.ozodrukh:CircularReveal:1.1.1') {
transitive = true;
}
testCompile 'junit:junit:4.12'
compile project(':paralaxed_viewpager')
compile project(':tooltiplibrary'){
exclude module: 'support-v4'
}
compile project(':pinview_lib')
compile 'com.github.travijuu:numberpicker:1.0.7'
compile 'com.razorpay:checkout:1.4.1'
compile 'com.github.travijuu:numberpicker:1.0.7'
compile 'com.razorpay:checkout:1.4.1'
compile project(':country_code_picker_library')
compile 'com.github.satyan:sugar:1.5'
compile 'org.igniterealtime.smack:smack-android:4.1.6'
compile 'org.igniterealtime.smack:smack-tcp:4.1.6'
compile 'org.igniterealtime.smack:smack-im:4.1.6'
compile 'org.igniterealtime.smack:smack-extensions:4.1.6'
compile 'com.jackandphantom.android:circularprogressbar:1.2.0'
compile 'com.jaredrummler:material-spinner:1.2.4'
compile 'com.skyfishjy.ripplebackground:library:1.0.1'
compile 'com.wonderkiln:camerakit:0.13.1'
compile 'com.droidninja:filepicker:2.1.2'
compile project(':autocompleteview')
compile 'com.appsflyer:af-android-sdk:4.8.7#aar'
compile 'com.android.installreferrer:installreferrer:1.0'
Just change the version of a dependency-
from
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
to
compile 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
Sync >> Clean >> Rebuild , and Done
In my case this changes fixed my issue.
This error appeared after Android released Support Library v27.1.0 (February 2018).
I think, this error is because of some dependencies used in the project.
compile 'com.another.library:1.2.3'
compile '.....'
Since every dependency is another project, with its own dependencies. Android tries to add all of these to the project, when building. If a dependency uses another version of a support library, this kind of conflicts or duplicates may occur.
Probably one of your dependencies has a line in its gradle file, declaring:
compile 'com.android.support:design:27.+'
which means "use the newest release of v.27".
When v.27.1.0 has been released your own compile 'com.android.support:...:26.1.0' lines caused a duplicate.
To solve this out:
You can either update your own dependencies to the new version
or
-if you are able to find- you can exclude the support libraries from the dependency using v.27.1.0:
compile('com.another.library:1.2.3') {
exclude group: 'com.android.support', module: 'support-v13'
}
Change the dependency version
Use this
implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
instead of
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
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
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?
I am using AWS sdk for java for storing the app data in dynamodb and AWS sdk for android for using amazon services. But whenever I try to run the app it shows this error.
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: com/amazonaws/services/cognitosync/AmazonCognitoSync.class
build.gradle
dependencies {
compile 'com.github.PhilJay:MPAndroidChart:v2.0.9'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.github.AndroidDeveloperLB:MaterialPreferenceLibrary:5'
compile 'com.android.support:design:23.1.0'
compile files('libs/achartengine-1.1.0.jar')
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.joooonho:selectableroundedimageview:1.0.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.sothree.slidinguppanel:library:3.2.0'
compile 'com.appyvet:materialrangebar:1.3'
compile 'com.github.lzyzsd:circleprogress:1.1.0#aar'
compile 'com.amazonaws:aws-java-sdk:1.10.37'
compile 'com.amazonaws:aws-android-sdk-core:2.2.9'
compile 'com.amazonaws:aws-android-sdk-cognito:2.2.9'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.9'
compile 'com.amazonaws:aws-android-sdk-ddb:2.2.9'
I am stuck on it from hours. Please can someone help me with this
Thanks
I am adding code to my project which requires google-api-client, when I add it via the gradle dependency, I get a duplicate error.
Here is the gradle dependency list
dependencies {
compile 'com.adobe.creativesdk:image:4.0.0'
// compile project(':showcaseView')
compile project(':facebook')
compile project(':SwipeMenuListView')
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:design:22.2.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.android.gms:play-services:7.5.+'
compile 'com.google.android.gms:play-services-appinvite:7.5.0'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile 'org.apache.httpcomponents:httpcore:4.3.3'
compile 'commons-codec:commons-codec:1.9'
compile 'commons-io:commons-io:2.4'
compile 'com.google.gdata:core:1.47.1'
compile files('libs/tape-1.1.0.jar')
compile files('libs/gdata-photos-meta-2.0.jar')
compile 'com.google.api-client:google-api-client:1.20.0'
// compile 'com.google.http-client:google-http-client:1.20.0'
// compile files('libs/android-oauth-client-0.4.5.jar')
}
Here is the error that I receive
Execution failed for task ':FloomIt:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/common/collect/package-info.class
If I remove the google-api-client line from the dependency list, the error goes away.
Any suggestions on how to proceed?
That is because com.google.api-client:google-api-client depends on com.google.guava:guava-jdk5 but com.google.gdata:core depends on com.google.guava:guava. The JDK5 split is unfortunate.
Gradle allows you to override dependencies. Try replacing the gdata dependency with something like:
compile('com.google.gdata:core:1.47.1') {
exclude group: 'com.google.guava', module: 'guava'
}