从libs文件夹中的2个本地.aar文件中排除重复的类



我们可以从libs文件夹中的local.aar文件中删除重复的类吗。

Duplicate class com.regina.first.core.C$RefreshWebClientQueryIds found in modules jetified-regina-runtime.jar (abc.aar) and jetified-gms-sdk-debug-runtime.jar (xyz.aar)

我试过使用-

implementation (files('libs/abc.aar')) {
exclude 'com.regina.first.core.C'
}
implementation fileTree(dir: 'libs', include: ['xyz.aar'])

但是从gradle得到了以下回应,尽管我已经在使用gradle版本4.0.1-

Gradle DSL method not found: 'exclude()'
Possible causes:
The project 'atv-retail-app' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 4.0.1 and sync project
The project 'atv-retail-app' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin

根据Gradle官方文档,为了将包/组从依赖项中排除,您应该使用以下语法

dependencies {
implementation('commons-beanutils:commons-beanutils:1.9.4') {
exclude group: 'commons-collections', module: 'commons-collections'
}
}

最新更新