【发布时间】:2017-05-22 15:42:09
【问题描述】:
我需要排除第三方库 jar 文件中存在的类。我不知道排除组的确切语法格式。我尝试了以下语法来排除库“javax.xml.stream.jar”中名为 XMLConstants.class 的类。
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:multidex:1.0.1'
compile files('libs/xsdlib-1.5.jar')
compile files('libs/relaxngDatatype-2.2.jar')
compile files('libs/javax.xml.stream.jar'){
exclude module: 'javax-xml-stream'
}
compile files('libs/pull-parser-2.jar')
compile files('libs/javax.xml.bind.jar')
compile files('libs/java-rt-jar-stubs-1.5.0.jar')
compile files('libs/jaxen-core.jar')
compile files('libs/jaxen-dom4j.jar')
compile files('libs/jaxen-1.1-beta-2.jar')
}
如果我使用这种语法,我会收到以下错误。
Error:(52, 0) Could not find method exclude() for arguments [{module=javax-
xml-stream-XMLConstants}]
我是 android 新手,所以我需要知道如何编写语法来排除第三方库 jar 文件中的特定类。如果有任何其他方法可以做到这一点,请提出建议。提前致谢。
【问题讨论】:
标签: java android android-studio jar build.gradle