我将GraphHoper添加到项目中 - 我遇到了一个问题。我是Android的新手,请帮助我。据我了解,我已经从编译的代码中排除了此类?但是如何?谁可以告诉我。
错误:执行任务失败':transformclasseswithjarmergingforrelese'。
com.android.build.api.transform.transformexception:java.util.zip.zipexception:重复输入:org/slf4j/helpers/basicmarker.class.class.class
这是我的gradle文件
apply plugin: 'com.android.application'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
compile 'com.google.zxing:core:3.2.0'
compile 'com.google.code.gson:gson:2.5'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.github.MKergall:osmbonuspack:5.9'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.android.support:multidex:1.0.1'
compile 'net.lingala.zip4j:zip4j:1.3.2'
compile('com.graphhopper:graphhopper:0.8-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:mapsforge-core:0.6.1'
compile 'org.mapsforge:mapsforge-map:0.6.1'
compile 'org.mapsforge:mapsforge-map-android:0.6.1'
compile 'org.mapsforge:mapsforge-map-reader:0.6.1'
/*
compile group: 'org.slf4j', name: 'slf4j-android', version: '1.7.12'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.12'
*/
}
repositories {
jcenter()
}
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
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...
instrumentTest.setRoot('tests')
// 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')
}
productFlavors {
}
dexOptions {
}
}
apply plugin: 'com.google.gms.google-services'
尝试使用以下依赖关系,对我有用,
编译'org.slf4j:slf4j-android:1.7.21'
,还要确保仅添加一次。
我找到了一个解决方案。问题在于这部分
compile fileTree(include: ['*.jar'], dir: 'libs')
有一个旧版本的lib。感谢大家的帮助