Duplicate entry error when integrating appodeal - android

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'.

Related

I am getting gradle error Execution failed for task

I am getting this error
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/volley/AuthFailureError.class
I attached my gradle please check and help me.
android {
useLibrary 'org.apache.http.legacy'
}
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 files('libs/android-async-http-1.4.4.jar')
compile files('libs/disklrucache-2.0.1.jar')
compile files('libs/google-gson.jar')
compile project(':linkedin-sdk')
compile files('libs/PGSDK_V2.0.jar')
compile 'com.android.support:support-v13:25.3.1'
compile files('libs/okhttp-1.2.1-jar-with-dependencies.jar')
compile files('libs/volley.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.razorpay:checkout:1.4.1'
compile 'com.google.android.gms:play-services-auth:9.2.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.jjoe64:graphview:4.2.0'
}
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.>
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/android/volley/AuthFailureError.class
Remove
compile files('libs/volley.jar') // From local lib also
Use
compile 'com.android.volley:volley:1.0.0'
I am using linkedin sdk,inside linkedin adk also one volley compile is
there and my app level I have one more volley dependency.
You should call volley:1.0.0 there.
Remove Below jar file from gradle
compile files('libs/volley.jar')
compile files('libs/google-gson.jar')
and compile below dependency
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.android.gms:play-services-auth:11.4.0'

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'
}

Duplicate jar file Error

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

TransformException duplicate entry for android.support.annotation.AnyRes.class

I'm getting following error when tried to build project.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:android/support/annotation/AnyRes.class
I tried to solve with the help of link here, But it's not working.
My build.gradle is below
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gson-2.2.2.jar')
compile files('libs/okhttp-2.2.0.jar')
compile files('libs/okhttp-urlconnection-2.0.0.jar')
compile files('libs/okio-1.0.0.jar')
compile files('libs/retrofit-1.9.0.jar')
compile files('libs/easyandroidanimationslibrary.jar')
compile project(':materialDialog')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'jp.wasabeef:recyclerview-animators:1.3.0'
compile 'com.github.rey5137:material:1.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile "com.google.android.gms:play-services:8.3.0"
}
I've added
multiDexEnabled true
in defaultConfig

Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException

I'm using Android Studio for the first time and I got the following error
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2
build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':tag-cloud')
compile('com.twitter.sdk.android:twitter:1.8.0#aar') {
transitive = true;
}
compile files('libs/bolts-android-1.2.1.jar')
compile files('libs/aws-android-sdk-s3-2.2.6.jar')
compile files('libs/aws-android-sdk-core-2.2.6.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.koushikdutta.ion:ion:2.1.6'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:design:23.0.1'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'de.greenrobot:eventbus:2.4.0'
compile files('libs/FlurryAnalytics-6.2.0.jar')
compile 'me.leolin:ShortcutBadger:1.1.3#aar'
}
Do you have any idea what the problem could be and how can it be solved? A good explanation for the problem would be useful too as I am new to Android Studio. Thanks in advance :)
This options may solve the issue
Clean The Project
Remove all unused dependencies in build.gradle
If not solved then Declare this in gradle config.
defaultConfig {
multiDexEnabled true
}

Categories

Resources