1

I am generating a signed apk in android studio but I'm getting following error:

Error:Execution failed for task ':msapp_V_520:transformClassesWithJarMergingForRelease'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/ColorRes.class

This is my build.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    signingConfigs {
        release {
        }
    }
    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v4'
    }

    compileSdkVersion 23
    buildToolsVersion '23.0.3'
    defaultConfig {
        applicationId "com.mouthshut"
        minSdkVersion 14
        targetSdkVersion 23
        multiDexEnabled true
        useLibrary 'org.apache.http.legacy'
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }
    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
    buildTypes {
        release {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }
}

dependencies {

    compile project(':comnostra13exampleuniversalimageloaderHomeActivity')
    compile project(':nineoldandroid')
    compile project(':libraryActionbar')
    compile project(':pullToRefresh')
    compile project(':facebook')
    compile 'com.google.android.gms:play-services:+'
    compile 'com.android.support:multidex:1.0.+'
    compile files('libs/AF-Android-SDK-v2.3.1.19.jar')
    compile files('libs/classes.jar')
    compile files('libs/CleverTapAndroidSDK-v1-20150903.jar')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    //compile 'com.github.adrian110288:LoadIndicators:83ce610325'
    compile project(':LoadIndicatorLibrary')
    compile 'com.nispok:snackbar:2.11.+'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }
    compile 'com.android.support:appcompat-v7:23.3.0'
}
Mahm00d
  • 3,881
  • 8
  • 44
  • 83
  • There is a problem with your gradle dependencies. Please check it. – Madhukar Hebbar May 16 '16 at 08:31
  • @MadhukarHebbar Please see my edited question It includes my build.gradle file and please give suggestion about the problem. – user2107940 May 17 '16 at 05:02
  • Facebook SDK may conflict with the support library.Chek [here](http://stackoverflow.com/questions/17693651/facebook-integration-android-support-v4-content-localbroadcastmanager) and [here](http://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult). It may help you. – Madhukar Hebbar May 17 '16 at 06:20
  • @MadhukarHebbar I tried your solution but it is not working. – user2107940 May 17 '16 at 07:17

1 Answers1

0

Exclude the support-v4 module when adding the facebook dependeicy.

compile (project(':facebook')) {
    exclude module: 'support-v4'
}
Viral Patel
  • 32,418
  • 18
  • 82
  • 110