Java 任务执行失败';:应用程序:使用Jarmergingfordebug和x27转换类;

Java 任务执行失败';:应用程序:使用Jarmergingfordebug和x27转换类;,java,android,android-studio,build.gradle,mapsforge,Java,Android,Android Studio,Build.gradle,Mapsforge,在我的应用程序中,我使用graphhopper和buttombar。此解决方案是graphhopper依赖项之一 错误:任务“:app:transformClassesWithJarMergingForDebug”的执行失败 com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:com/lividSolutions/jts/algorithm/Angle.class 这是我的身材,格

在我的应用程序中,我使用graphhopper和buttombar。此解决方案是graphhopper依赖项之一

错误:任务“:app:transformClassesWithJarMergingForDebug”的执行失败

com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:com/lividSolutions/jts/algorithm/Angle.class

这是我的身材,格雷德尔

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'
}

将此添加到build.gradle中:

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

这对我来说很有效

将此添加到您的构建中。gradle:

configurations {
    all*.exclude group: 'com.vividsolutions', module: 'jts-core'
}
这对我很有用 您正在添加这样的库
(A) 。编译文件('libs/YOUR_LIBRARY.jar')
并且此库包已在您的代码中可用
如注释或删除此行
//编译文件('libs/YOUR_LIBRARY.jar')

如何知道项目中库的副本:
解压缩“your_LIBRARY.jar”,并在代码中看到相同的类名

您正在添加这样的库
(A) 。编译文件('libs/YOUR_LIBRARY.jar')
并且此库包已在您的代码中可用
如注释或删除此行
//编译文件('libs/YOUR_LIBRARY.jar')

如何知道项目中库的副本:
解压缩“your_LIBRARY.jar”,并在代码中看到相同的类名

为什么要添加compile'com.livitSolutions:jts core:1.14.0',而不是添加到graphhopper中。您要添加两次com/livitSolutions/jts/algorithm/Angle.classr为什么要添加compile'com.livitSolutions:jts core:1.14.0',而不是添加到graphhopper中。您要添加两次com/livitSolutions/jts/algorithm/Angle.class