Cst*_*le5 7 java android gradle
我正在尝试构建和维护一个旧的应用程序,但我无法通过构建阶段.在我的app/build.gradle
文件中我有
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.apache.commons:commons-io:1.3.2'
//some more libraries compiled as well
}
Run Code Online (Sandbox Code Playgroud)
但在尝试执行时遇到以下错误:
错误:任务':myApp'的执行失败.com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:org/apache/commons/io/CopyUtils.class
这几乎可以肯定是因为当我编译那个jar时,在我的外部库树的顶部,生成了这个:
为什么会发生这种情况,如何让它停止以便我可以完成构建?
Nav*_*r M 13
可以选择在gradle依赖关系解析级别上修复它
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module('org.apache.commons:commons-io:1.3.2') with module('commons-io:commons-io:1.3.2')
}
}
Run Code Online (Sandbox Code Playgroud)
冲突的原因是org.apache.commons:commons-io:1.3.2
错误推送/sf/answers/2619525611/
您可以看到依赖关系的来源
gradle :main:dependencyInsight --configuration compile --dependency commons-io
有一种简单的方法可以排除双重类.首先,如果您知道使用此代码,则需要找出导致该依赖项的依赖项:
compile('com.example:some-dependency:4.2') {
exclude module: 'commons-io'
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8129 次 |
最近记录: |