Binil Surendran
Binil Surendran

Reputation: 2554

Android: 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/annotation/DimenRes.class

Here is my build.gradle

apply plugin: 'com.android.application'



 android {
    compileSdkVersion 'Google Inc.:Google APIs:23'
    buildToolsVersion "24.0.0"
    compileOptions.encoding = 'windows-1251'
    defaultConfig {
        applicationId "org.radiomango.app"
        minSdkVersion 11
        targetSdkVersion 23
        multiDexEnabled true
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = false
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles 'proguard.cfg'
        }
    }
    }

    dependencies {
    compile 'com.google.code.gson:gson:2.2.2'
    compile files('libs/acra-4.5.0.jar')
    compile files('libs/android-support-v13.jar')
    compile files('libs/org.apache.commons.httpclient.jar')
    compile files('libs/org.apache.http.legacy.jar')
    compile project(':seekArc_library')
    compile project(':socialauthandroid')
    compile project(':SwipeMenuListView')
    compile 'com.android.support:design:24.0.0'

}

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 restart the android studio, but the issue still exciting.

Can any one please help me

Upvotes: 1

Views: 7813

Answers (3)

Arjun saini
Arjun saini

Reputation: 4182

Replace

compile files('libs/android-support-v13.jar')

with

com.android.support:support-v13:24.0.0

Apply this in gradle also add packagingOptions

 apply plugin: 'com.android.application'

android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "24.0.0"
compileOptions.encoding = 'windows-1251'
defaultConfig {
    applicationId "org.radiomango.app"
    minSdkVersion 11
    targetSdkVersion 23
    multiDexEnabled true
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

  packagingOptions {
    exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
    exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}
dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = false
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles 'proguard.cfg'
    }
}
}

dependencies {
compile 'com.google.code.gson:gson:2.2.2'
compile files('libs/acra-4.5.0.jar')
compile 'com.android.support:appcompat-v7:23.4.0'
complie  `com.android.support:support-v13:24.0.0` //or you used  23.4.0 
compile files('libs/org.apache.commons.httpclient.jar')
compile files('libs/org.apache.http.legacy.jar')
compile project(':seekArc_library')
compile project(':socialauthandroid')
compile project(':SwipeMenuListView')
compile 'com.android.support:design:24.0.0'//or you used compile 'com.android.support:design:23.4.0'

 }

Upvotes: 1

Christopher
Christopher

Reputation: 10259

Replace

compile files('libs/android-support-v13.jar')

with

com.android.support:support-v13:24.0.0

You added the design library, which also makes use of the support-v4 lib. If you add both via maven-dependency, this should be handled by gradle.

Upvotes: 1

Dipali Shah
Dipali Shah

Reputation: 3798

I think this is because you use compile files('libs/android-support-v13.jar') and compile 'com.android.support:design:24.0.0' may be this library are conflicting with each other.

Exclude part of library which is common in both of them. Using exclude e.g.

compile('com.commonsware.cwac:camera-v9:0.5.4') {
  exclude module: 'support-v4'
}

Upvotes: 2

Related Questions