程序类型已存在androidx.exifinterface.R

程序类型已存在androidx.exifinterface.R,android,gradle,Android,Gradle,我最近在我的android项目中添加了implementation'com.google.android.play:core:1.6.4',现在Intellij抱怨程序类型已经存在:androidx.exifinterface.R。这意味着什么?我该如何解决 注意:这是一个问答问题。我已经找到了一个解决方案,我想与其他人分享。我最近遇到了一个问题,android studio会抱怨程序类型已经存在:androidx.exifinterface.R。这是在添加了实现'com.google.andr

我最近在我的android项目中添加了
implementation'com.google.android.play:core:1.6.4'
,现在Intellij抱怨
程序类型已经存在:androidx.exifinterface.R
。这意味着什么?我该如何解决


注意:这是一个问答问题。我已经找到了一个解决方案,我想与其他人分享。

我最近遇到了一个问题,android studio会抱怨程序类型已经存在:androidx.exifinterface.R。这是在添加了
实现'com.google.android.play:core:1.6.4'
依赖项之后发生的。我以前在
androidx.asynclayoutinflater.R
中偶然发现了这一点。我发现,向模块级gradle文件中添加类似以下内容可以解决此问题:

configurations.all {
    // This is from a previous, similar issue
    exclude group: "androidx.asynclayoutinflater", module: "asynclayoutinflater"

    // This is the LOC that fixed the issue in this post
    exclude group: "androidx.exifinterface", module: "exifinterface"
}
这种模式似乎是:

if there's a complaint about androidx.MODULE_X.R already being present
then add 
    exclude group: "androidx.MODULE_X", module: "MODULE_X"
to configurations.all in module level gradle file
这对AsyncLayoutFlater和now exifinterface都有效。我不知道这种模式是否适用,但到目前为止它已经奏效了。我对潜在问题的理解是,模块依赖关系图中的两个依赖关系(例如
com.google.android.play:core
)明确包含有问题的模块(例如
exifinterface
),因此我们需要排除其中一个明确的依赖关系。我的理解可能是错误的