Search code examples
javaandroidgradlew

duplicate entry android support v4 in serviceinfoversion impl.class


i have this error :

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.class

on this build.gradle app :

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.mtma.mytripmyadventure"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile('com.android.support:support-v4:23.4.0') {
        force = true;
    }
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.roughike:bottom-bar:1.2.1'
    compile 'com.google.android.gms:play-services-maps:9.8.0'
    compile 'com.android.support:support-v4:23.4.0'
}

i have try many things to do but the result still the same

i have add all*.exclude group: 'com.android.support', module: 'support-v4'

but still error

help me to resolve this.. icant resolve it in 1 day thx stackoverflow


Solution

  • That error in your latest comment is completely different as it relates to an XML issue in your Activity.

    You do not need the support-v4 dependency explicitly. It is included with the v7 dependency. That being said, definitely do not need to force = true on it

    The solution to the first error is remove both dependencies of compile 'com.android.support:support-v4