java.util.zip.ZipException: duplicate entry: com/amazonaws/services/cognitosync/AmazonCognitoSync.class - android

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

Related

duplicate Entry com/google/zxing/BarcodeFormat.class

When I am running the app on Android 6.0 and above directly through run from android studio then able to run the app successfully. But when creating a build through build apk from android studio then I am getting following error :
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/zxing/BarcodeFormat.class**
Below is my gradle file :
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.6.1#aar') {
transitive = true;
}
compile('com.digits.sdk.android:digits:1.11.2#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
compile 'com.wdullaer:materialdatetimepicker:2.4.0'
compile 'com.google.android.gms:play-services:11.0.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.koushikdutta.ion:ion:2.1.8'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'testfairy:testfairy-android-sdk:1.+#aar'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.orhanobut:dialogplus:1.11#aar'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'dev.dworks.libs:volleyplus:+'
testCompile 'junit:junit:4.12'
}
You can exclude "com.google.zxing" module "core"
implementation('com.facebook.android:facebook-android-sdk:{VERSION}') {
exclude group: "com.google.zxing", module: 'core'
}
you need to use same version depedency of firebase
use this
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-core:11.0.1'
compile 'com.google.firebase:firebase-auth:11.0.1'
instead of this
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-auth:11.0.1'
You might be having same file named as BarcodeFormat.java in your project. Please rename it to anything else and see if the error gets solved.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/multidex/MultiDex$V14.class

this is my build.gradle,when I run app ,it report this error mesaage:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/multidex/MultiDex$V14.class
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':library')
compile project(':pullToRefreshLibrary')
compile files('libs/flame.jar')
compile files('libs/httpclient-4.2.4.jar')
compile files('libs/httpcore-4.2.4.jar')
compile files('libs/httpmime-4.2.4.jar')
compile files('libs/mp3agic.jar')
compile files('libs/libammsdk.jar')
compile files('libs/ShareSDK-Core-2.8.3.jar')
compile files('libs/oraleval-android-sdk.jar')
compile 'fm.jiecao:jiecaovideoplayer:5.5.2#aar'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
//google play
compile 'com.uwetrottmann.photoview:library:1.2.4'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.4'
compile 'com.wdullaer:materialdatetimepicker:2.5.0'
compile 'com.getui:sdk:2.9.5.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
//Logger
compile 'com.orhanobut:logger:2.1.1'
compile files('libs/xUtils-2.6.14.jar')
compile files('libs/mta-sdk-1.6.2.jar')
compile files('libs/open_sdk_r5793.jar')
//wechat
compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:1.0.2'
//banner
compile 'com.youth.banner:banner:1.4.9'
//recyclerview
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.nineoldandroids:library:2.4.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//cardview
compile 'com.android.support:cardview-v7:23.1.1'
compile files('libs/AndroidPicker-1.5.3.jar')
compile 'com.tencent.bugly:crashreport:latest.release'
compile 'com.tencent.bugly:nativecrashreport:latest.release'
compile files('libs/fastjson-1.2.5.jar')
compile project(':photodraweeview')
compile 'com.facebook.fresco:fresco:0.11.0'
compile 'com.facebook.fresco:animated-gif:0.11.0'
compile 'org.litepal.android:core:1.5.0'
compile 'com.jcodecraeer:xrecyclerview:1.3.2'
compile files('libs/giisosdk.jar')
compile 'com.android.support:multidex:1.0.1'
}
First of all, you need to use the same version for support library, like this:
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
//cardview
compile 'com.android.support:cardview-v7:23.1.1'
Then try only use one of JSON library, gson or fastjson:
compile 'com.google.code.gson:gson:2.7'
//compile files('libs/fastjson-1.2.5.jar')

Paytab Payment gateway not working

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.

Duplicate files copied android studio

I have been trying to integrate admob into my project when suddenly this error appears
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK jsr305_annotations/Jsr305_annotations.gwt.xml
File1: C:\Users\SkyPunch\AndroidStudioProjects\GyanBox\app\build\intermediates\exploded-aar\com.longtailvideo.jwplayer\jwplayer-android-sdk\2.4.1+158\jars\classes.jar
File2: C:\Users\SkyPunch\AndroidStudioProjects\GyanBox\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-basement\9.4.0\jars\classes.jar
I think its an issue with same classes in two liberaries
I have used these
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.github.amlcurran.showcaseview:library:5.4.0'
compile 'com.github.castorflex.verticalviewpager:library:19.0.1'
compile 'com.github.curioustechizen.android-ago:library:1.3.0'
compile 'com.nononsenseapps:filepicker:2.4.2'
compile 'com.rockerhieu.emojicon:library:1.3.3'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'org.apmem.tools:layouts:1.10#aar'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.neovisionaries:nv-websocket-client:1.23'
compile 'com.theartofdev.edmodo:android-image-cropper:1.2.6'
compile 'com.longtailvideo.jwplayer:jwplayer-android-sdk:+'
compile 'com.android.support:percent:23.3.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'
How can i resolve this without removing any of the libraries
Edit: i found that by following it can be resolved
packagingOptions {
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
}
Will this have any impact on app. Am i excluding an important file?

For below android version-5 i am getting ZipException with duplicate entry: com/google/api/client/http/AbstractHttpContent.class

Not able to install app in android version 4.4 I am getting error like:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/api/client/http/AbstractHttpContent.class
I have tried this solution but it didn't worked for me.
Here is my app dependencies
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:support-v13:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.google.code.gson:gson:2.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-nearby:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile('com.twitter.sdk.android:twitter:1.13.0#aar') {
transitive = true
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile project(':library')
compile project(':facebook-android-sdk-4.8.1')
}
dependencies for library module
dependencies {
compile 'com.android.support:support-annotations:22.2.0'
}

Categories

Resources