Search code examples
androidandroid-studioandroid-gradle-pluginsharethis

:app:packageAllDebugClassesForMultiDex FAILED, ...zip.ZipException: duplicate entry: android/...v4/widget/SearchViewCompatIcs$MySearchView.class


I've been working on this issues for a several hours but can't find the solution. Tried a lots of answers from stackoverflow but no luck.

What am I getting is the following gradle error while running the app:

:app:packageAllDebugClassesForMultiDex FAILED
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v4/widget/SearchViewCompatIcs$MySearchView.class

Android studio throws the error when i add the dependency of ShareThis Sdk into the gradle. Here is the full gradle:

apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            keyAlias 'Alies'
            keyPassword 'password'
            storeFile file('path.jks')
            storePassword 'password'
        }
    }
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "example.com.app"
        minSdkVersion 10
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        preDexLibraries = false
        incremental true
    }
    //configurations { all*.exclude group: 'com.android.support', module: 'support-v4' }
    //configurations { all*.exclude module: 'support-v4' }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    provided files('libs/universal-image-loader-1.9.3.jar')
    compile project(':library-circular')
    compile('com.android.support:appcompat-v7:22.2.0') {
        exclude group: 'com.android.support', module: 'support-v4'
    }
    compile project(':sliding_library1')
    compile('com.google.android.gms:play-services:7.5.0') {
        exclude group: 'com.android.support', module: 'support-v4'
    }
    compile project(':sdk')
}

A small help will be greatly appreciated.


Solution

  • So, the problem has been resolved. Actually there was a conflict between support-v4 jar files, So I simply used the same support-v4.jar everywhere and the problem is fixed.