Burcu Ay
Burcu Ay

Reputation: 1

Execution fail for task ':app:transformClassesWithJarMergingForDebug'

In my application i use graphhopper and buttombar. This vividsolution is one of the graphhopper dependencies.

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/vividsolutions/jts/algorithm/Angle.class

this is my build.gradle

android {

    compileSdkVersion 25

    buildToolsVersion "25.0.0"

    defaultConfig {

        applicationId "com.segunfamisa.sample.bottomnav"

        minSdkVersion 14

        targetSdkVersion 25

        versionCode 1

        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        multiDexEnabled=true
    }
    buildTypes {

        release {

            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

        }

        lintOptions {

            /* CGIARProvider refers to java.awt
             * Helper7 refers to java.lang.management
             * HeightTile refers to javax.imageio and java.awt
             * OSMElement refers to javax.xml.stream
             */
            disable 'InvalidPackage'
        }
    }

}

dependencies {

    compile fileTree(dir: 'libs', include: ['*.jar'])


    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:design:25.0.0'


    compile 'org.mapsforge:vtm:0.7.0'
    compile 'org.mapsforge:vtm-android:0.7.0'
    compile('com.graphhopper:graphhopper-core:0.9-SNAPSHOT') {
        exclude group: 'com.google.protobuf', module: 'protobuf-java'
        exclude group: 'org.openstreetmap.osmosis', module: 'osmosis-osm-binary'
        exclude group: 'org.apache.xmlgraphics', module: 'xmlgraphics-commons'
    }
    compile 'org.mapsforge:vtm-android:0.7.0:natives-armeabi'
    compile 'org.mapsforge:vtm-android:0.7.0:natives-armeabi-v7a'
    compile 'org.mapsforge:vtm-android:0.7.0:natives-x86'
    compile 'org.mapsforge:vtm-jts:0.7.0'
    compile 'org.mapsforge:vtm-themes:0.7.0'
    compile 'com.caverock:androidsvg:1.2.2-beta-1'
    compile 'com.vividsolutions:jts-core:1.14.0'
    compile 'org.slf4j:slf4j-api:1.7.21'
    compile 'org.slf4j:slf4j-android:1.7.21'
}

Upvotes: 0

Views: 186

Answers (2)

Satendra Behre
Satendra Behre

Reputation: 159

You are adding a library like this
(A). compile files('libs/YOUR_LIBRARY.jar')
and this library package already available in your code.
comment it like or remove this line
//compile files('libs/YOUR_LIBRARY.jar')

How to know duplicate-copy of library in your project:
unzip your "YOUR_LIBRARY.jar" and see the same class name in your code.

Upvotes: 0

Amina T
Amina T

Reputation: 21

Add this to your build.gradle :

configurations {
    all*.exclude group: 'com.vividsolutions', module: 'jts-core'
}

It worked for me

Upvotes: 2

Related Questions