duplicate entry: android/support/v4/graphics/drawable/DrawableCompatHoneycomb.class - android

After changing minimum sdk to 16 i've got that error
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/graphics/drawable/DrawableCompatHoneycomb.class
this is my build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.nicoleiesperida.crazyjeepney"
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Application.mk'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
dependencies {
compile 'com.google.android.gms:play-services:+'
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-19.0.1.jar')
compile 'com.facebook.android:facebook-android-sdk:4.+'
}

The same class is being provided by two different dependencies. run
gradle app:dependencies
or
./gradlew app:dependencies
where app is the app project name. Then locate the support v4 package and exclude it from the dependency. Probably it's facebook.

Related

Error while generating a signed apk in Android Studio

I want to generate an apk file out of my project but I keep getting this error while generating the signed apk:
Execution failed for task ':app:transformClassesWithJarMergingForRelease'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$PrintHelperStubImpl.class
I'm searching since 6 hours for a solution now and I have tried nearly everything but I can't fix it. Does anyone know how to fix this?
This is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.pake.lightbulb"
minSdkVersion 14
targetSdkVersion 26
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.txt'
}
}
sourceSets.main
{
jni.srcDirs=[]
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
all*.exclude group: 'com.android.support', module: 'support-annotations'
}
}
dependencies {
compile('com.google.android.gms:play-services:+')
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
}
Most probably support-v4 library gets also included via the play-services dependency. To exclude it change the relevant dependency line of your gradle to:
compile('com.google.android.gms:play-services:+')
{
exclude module: 'support-v4'
}
To troubleshoot it more and inspect for other duplicates and conflicts, check the dependency tree command of gradle:
gradle -q dependencies --configuration compile

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'?

Am getting en error while try to run the project
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$PrintHelperStubImpl.class
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.codecanyon.khalyil"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
ndk {
moduleName "player_shared"
}
dexOptions {
javaMaxHeapSize "4g"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
main {
jni.srcDirs = []
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:10.2.6'
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-19.0.1.jar')
compile 'com.android.support:multidex:1.0.1'
}
i tried by cleaning the project
Build - > Clean
after that rebuild, But no effect
The i sync and clean the project, still no result.
Finally i click on 'build apk', but the issue still exciting.
Can any one please help me
The problem here is that you have a class that is included in two dependencies. This is most likely the v4 support lib. Check if one of your dependencies dont include the v4 support library which you already include yourself. You can exclude a dependency this way:
compile ('com.somesdk:sdk:1.3.5#aar') {
transitive=true //you dont need this if you use jars or non-aar dependencies
exclude group: 'com.android.support'
}

Build Failed 'duplicate entry: com/google/api/client/googleapis/auth/clientlogin/ClientLogin$Response.class

Error description:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/api/client/googleapis/auth/clientlogin/ClientLogin$Response.class
build.gradle code here
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion '23.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.jasp.eventapp"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.8.2'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.couchbase.lite:couchbase-lite-android:1.4-46'
//compile 'com.google.api-client:google-api-client-android:1.22.0'
//compile 'com.google.api-client:google-api-client-xml:1.22.0'
compile 'com.google.api.client:google-api-client:1.4.1-beta'
compile 'com.google.api-client:google-api-client-jackson2:1.22.0'
compile files('libs/google-api-client-1.5.0-beta.jar')
compile 'com.google.android.gms:play-services:9.2.1'
}
Any version problem in imported libs...?How can I handle this...?I tried by cleaning the project
Build - > Clean
after that rebuild, But no effect...Can any one please help me...
This error occurs when you are using duplicate version of same library, or when you use a library project which has same dependency
compile 'com.google.api.client:google-api-client:1.4.1-beta'
compile 'com.google.api-client:google-api-client-jackson2:1.22.0'
compile files('libs/google-api-client-1.5.0-beta.jar')
these three looks like same library , removing duplicate version of the library should fix your error
I had the same problem with Feign library. Look in the .idea\libraries directory in your project, find the same library with different versions and remove one. It should be help.

How to fix duplicate entry ZipException in android?

I am using EBS payment gateway in my android application. EBS includes volley library in its folder. Also I use volley library for my project.So I get an exception like this.
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/android/volley/AuthFailureError.class
And below is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
repositories {
mavenCentral()
}
configurations{
all*.exclude group: 'com.android.volley', module: 'toolbox'
}
defaultConfig {
applicationId "com.example.nivedha.rents"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile project(':EBS')
}
Help me out to fix this issue..
Do like this :
When you added com.mcxiaoke.volley:library-aar:1.0.0 your some of the dependencies got clashed
So, now what you have to do is
Search CTRL+SHIFT+N in android studio for the class AuthFailureError.class
See which jar contains this and remove it like below (This is just as an example/You have to figure out the duplicate class and manually remove it)
configurations{
all*.exclude module: 'toolbox'
}

java.util.zip.ZipException: duplicate entry: com/facebook/ads/AbstractAdListener.class

I am trying to implement facebook mobile ads in an android app. Everything went fine but in build gradle i m getting error.
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry:
com/facebook/ads/AbstractAdListener.class.
And build.gradle codes are
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.mohit.warmodroid.practicefbads"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
multiDexEnabled true
}
}
}
dependencies
{
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile ('junit:junit:4.12'){
exclude group: 'com.facebook.ads', module: 'classes.jar'
}
compile 'com.android.support:appcompat-v7:23.0.1'
compile ('com.android.support:design:23.0.1'){
exclude group: 'com.facebook.ads', module: 'classes.jar'
}
compile('com.facebook.android:audience-network-sdk:4.7.0'){
exclude group: 'com.facebook.ads', module: 'classes.jar'
}
compile 'com.android.support:multidex:1.0.0'
}
I tried everything availble on stackoverflow.com but unable to clear it.
Please help me out.
In the Gradle settings and project configurations there is an old version of AudienceNetwork.jar, existing in the \libs folder. Remove this jar file from \libs and rebuild the project: this should fix the problem.

Categories

Resources