Search code examples
androidgradleandroid-gradle-pluginandroid-gradle-2.0android-gradle-2.2

Duplicate v4 Support issue.Tried all options.Help Needed


I am working nearly 2 days to get rid of v4 dulicate issue on signed apk build.I have Two Modules. The one SDK which connects FB has v4 SUpport.

I have excluded v4 from everywhere on gradle but still i am getting

Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/graphics/drawable/DrawableCompat.class

Gradle:app :

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.madlab.wapp.sais"
        minSdkVersion 9
        targetSdkVersion 20
        versionCode 4
        versionName "2.2"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt')
        }
    }

    dependencies {
        compile ('com.android.support:appcompat-v7:25.3.1')
        compile project(':getsocialize')
    }
}

**Gradle: sdk:**

    apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'


dependencies {
    compile 'com.socialize:facebook:3.1.3-SNAPSHOT'
    compile 'com.socialize:ioc:3.1.3-SNAPSHOT'
    compile 'com.socialize:loopy:3.1.7'
    // compile 'com.socialize:library:3.1.6'
    compile files('libs/commons-codec-1.4.jar')
}

android {
    compileSdkVersion 20
    buildToolsVersion '25.0.2'

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
        testApplicationId "com.socialize.test"
        testInstrumentationRunner "com.socialize.SocializeTestRunner"
        multiDexEnabled true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        androidTest {
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        androidTest.setRoot('../test')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

I could see the class is in both v7 and v4 with CNtl+N even after exclude on v7.

image description

even if i manually remove the jar Whenever i ran build i am getting jar automatically in C:\Users\subash\AndroidStudioProjects\Sais\sdk\build\intermediates\exploded-aar\com.socialize\facebook\3.1.3-SNAPSHOT\jars\libs.

I ran dependencies on gradle also No issue identified on that. I really appreciate help and guidance for solving the issue

Adding External Libraries V4 issue:

enter image description here


Solution

  • Removed app compactV7(used for app theme) which includes v4-support on compile and changed app theme to material .