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?
Related
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.
I am getting below error log:
Error:Execution failed for task
'app:transformClassesWithJarMergingForDebug'.>
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
android/support/annotation/Keep.class
Here is the list of build.gradle dependencies:
dependencies {
compile project(':chartboostSDK')
compile project(':flurry_lib')
compile project(':googleCloudMessaging_lib')
compile project(':mainLibProj')
compile project(':localytics_lib')
compile project(':mobihelp_sdk_android_v1534')
compile project(':unityandroidresources')
compile project(':iAB_lib')
compile project(':etcetera_lib')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.android.gms:play-services:+'
compile files('libs/FlurryPlugin.jar')
compile files('libs/FreshdeskPlugin.jar')
compile files('libs/Prime31UnityActivity.jar')
compile files('libs/adcolony-adapter-1.1.6.jar')
compile files('libs/android-bridge.jar')
compile files('libs/apsalar.jar')
compile files('libs/apsalarUnity3d.jar')
compile files('libs/bolts-android-1.2.1.jar')
compile files('libs/chartboost-adapter-1.0.6.jar')
compile files('libs/crittercism_v5_4_3_sdkonly.jar')
compile files('libs/dagger.jar')
compile files('libs/emojiplugin.jar')
compile files('libs/in-app-purchasing-2.0.61.jar')
compile files('libs/javax.inject.jar')
compile files('libs/mediationsdk-6.3.5.jar')
compile files('libs/nativex-adapter-1.0.3.jar')
compile files('libs/nineoldandroids.jar')
compile files('libs/support-annotations-23.1.1.jar')
compile files('libs/tapjoyconnectlibrary.jar')
compile files('libs/tapjoyunitywrapper.jar')
compile files('libs/unity-classes.jar')
compile files('libs/vungle-adapter-1.1.6.jar')
compile files('libs/unity-classes.jar')
}
Try to import the library as a gradle dependency like this:
compile 'com.android.support:support-annotations:23.1.1'
If you want to use jar then it seems like that it hasn't been properly built. So try to do something like this:
Unzip the jar file. (Simply change .jar extension to .zip
This will remove the duplicate files.
Recreate the jar using jar cf xmlbeans.jar -C (path to unzipped folder) . (Mind it, there is a dot in the end of command)
Use this regenerated jar
Error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/analytics/internal/Command.class
I added the following dependencies
dependencies {
//compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile files('libs/twitter4j-core-4.0.2.jar')
compile project(':devsmartAndroid')
compile project(':FacebookSDK')
compile project(':libPhotoView')
compile files('libs/android-support-v4.jar')
compile project(':library')
//compile 'com.google.android.gms:play-services-gcm:7.5.0'
//compile 'com.google.android.gms:play-services-analytics:7.5.0'
compile files('libs/gcm.jar')
compile files('libs/libGoogleAnalyticsServices.jar') }
:app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/google/android/gms/analytics/internal/Command.class
Problem is here
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
You should call one
Finally
compile 'com.google.android.gms:play-services:8.4.0'
Edit
I assume libGoogleAnalyticsServices.jar creating Duplicate entry .
So you can comment just this jar
compile files('libs/libGoogleAnalyticsServices.jar')
In your Gradle file there are two dependencies
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
Instead of using both use only one
compile 'com.google.android.gms:play-services:8.4.0'
Because the play-services package is consolidated with all play services. otherwise add separately each one such as GCM,GA,etc
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'
}