0
我有一个库项目(Janrain:Jump),它使用org.apache.http.legacy
库。当我尝试建立我的项目,我得到重复的错误,如下列:在gradle |中不排除Apache commons依赖项Android
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/commons/codec/StringEncoderComparator.class
所以我想通了org.apache.commons
重复的条目,因为Janrain使用它,它也包含在Android的24(作为外部库)。于是,我就从删除公地:跳转gradle这个样:现在
configurations {
all*.exclude group: 'org.apache.commons'
}
,我期望这消除org.apache.commons
,但我仍然得到重复条目gradle这个错误。
这里是:跳转gradle这个文件
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
//If building with strict Android 6.0 the following will need to be uncommented
//See: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html
//And: http://stackoverflow.com/questions/31653002/how-to-use-the-legacy-apache-http-client-on-android-m
useLibrary "org.apache.http.legacy"
defaultConfig {
minSdkVersion 17
targetSdkVersion 24
// replace the below string with your own Google client ID. Make sure this is consistent
// with the values used in openid_appauth_idp_configs.xml
manifestPlaceholders = [
<my values>]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
configurations {
all*.exclude group: 'org.apache.commons'
}
dependencies {
compile 'com.android.support:support-v4:24.2.0'
compile files('libs/org.apache.http.legacy.jar')
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okhttp:okhttp-apache:2.5.0'
compile 'com.squareup.okio:okio:1.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit:retrofit:1.8.0'
compile 'net.openid:appauth:0.4.1'
}
allprojects {
repositories {
jcenter()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
为什么org.apache.commons
甚至不排除当我将其包含在配置?
是的,想通了什么添加重复的和它现在固定。 – Nerd