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
Related
error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/widget/StaggeredGridLayoutManager$SavedState$1.class
Dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':cheetah-mobile-3.4.7')
compile 'com.android.support:multidex:1.0.1'
compile('com.android.support:appcompat-v7:24.0.0') {
force = true;
}
compile('com.android.support:design:24.0.0') {
force = true;
}
compile 'com.google.firebase:firebase-ads:9.4.0'
compile 'com.google.android.gms:play-services-appindexing:9.4.0'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.github.deano2390:MaterialShowcaseView:1.1.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
Have you checked your libs folder?
If it contains recycle view , remove it and add to build.gradle so
compile 'com.android.support:recyclerview-v7:24.0.0'.
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?
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
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'
}
I'm trying to build my project with gradle, but I get this error message:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/ftpserver/ftplet/Authentication.class
So, I think the Authentication.class file is present in more than just ftp library, but I don't know how to fiw this error.
My gradle.build dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'org.apache.ftpserver:ftpserver-core:1.0.6'
compile 'cc.mvdan.accesspoint:library:0.2.0'
}
How to fix it?
The problem came from the ftpserver-core dependence.
I had to exclude the ftplet-api module from ftpserver-core dependence in gradle, because fplet-api is added two times.