未找到Gradle DSL方法:'exclude()' [英] Gradle DSL method not found: 'exclude()'
本文介绍了未找到Gradle DSL方法:'exclude()'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Android Studio中工作,当我在build.gradle文件中添加行时
I am working in Android Studio and when I added the line in build.gradle file
dependencies {
compile files('libs/poi-ooxml-schemas-3.12-20150511-a.jar'){
exclude group: 'stax', module: 'stax-api'
}
}
我发现错误:
I caught the error:
Gradle DSL方法未找到:'exclude()'
Gradle DSL method not found: 'exclude()'
错误的原因是什么?
推荐答案
您定义依赖关系的方式是将封闭应用于 files
compile
。
The way you defined the dependency, you applied the closure to files
instead of compile
.
files('libs/poi-ooxml-schemas-3.12-20150511-a.jar'){
exclude group: 'stax', module: 'stax-api'
}
相反,您必须确保直接将闭包应用于 compile
。
Instead you have to make sure to apply the closure to compile
directly.
compile(files('libs/poi-ooxml-schemas-3.12-20150511-a.jar')){
exclude group: 'stax', module: 'stax-api'
}
但我怀疑这是必要的。组和模块是Maven系统的一部分,JAR文件本身没有要排除的信息。
But I doubt it's necessary at all. Groups and modules are part of the Maven system and the JAR file itself doesn't have this information to exclude.
这篇关于未找到Gradle DSL方法:'exclude()'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文