[英]Getting this error “Modules 'base' and 'moduleA' contain entry 'res/drawable/xyz.xml' with different content.”
moduleA is a dynamic feature module with dependency which is an aar lib. moduleA 是一个具有依赖关系的动态功能模块,它是一个 aar 库。
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':app')
implementation(name:'lib', ext:'aar')
}
It builds successful and installs on the emulator but whenever I want to create an app-bundle, I get the following error:它构建成功并安装在模拟器上,但是每当我想创建一个应用程序包时,我都会收到以下错误:
Modules 'base' and 'moduleA' contain entry 'res/drawable/xyz.xml' with different content.
If I should rename xyz.xml in the app module, I get error:如果我应该在 app 模块中重命名 xyz.xml ,我会收到错误:
../moduleA/build/intermediates/metadata_feature_manifest/fullDebug/processFullDebugManifest/metadata-feature/AndroidManifest.xml:61:13-63:50: AAPT: error: resource drawable/xyz (aka my.app.main.drawable/xyz) not found.
This is one of the issues highlighted in Plaid's modularization article .这是Plaid 的模块化文章中强调的问题之一。
To solve it, I had to create an empty xyz.xml in the app module, but when creating an app-bundle, I get the error:为了解决这个问题,我不得不在 app 模块中创建一个空的 xyz.xml,但是在创建 app-bundle 时,我得到了错误:
Modules 'base' and 'moduleA' contain entry 'res/drawable/xyz.xml' with different content.
What is the problem and how can it be solved?问题是什么,如何解决?
As you removed base/.../xyz.xml
you won't be able to access it from your base module (app).当您删除
base/.../xyz.xml
时,您将无法从基本模块(应用程序)访问它。
If you rename base/.../xyz.xml
to base/.../zzz.xml
you will have to change references to it as well.如果您将
base/.../xyz.xml
重命名为base/.../zzz.xml
您还必须更改对它的引用。
If you don't access base/.../xyz.xml
in your base module at all, you can remove the file.如果您根本不访问基本模块中的
base/.../xyz.xml
,则可以删除该文件。 Then you'll have to make sure all your imports are pointing not to base.R.drawable.xyz
but to feature.R.drawable.xyz
.然后你必须确保你所有的导入都指向不是
base.R.drawable.xyz
而是feature.R.drawable.xyz
。
If both files actually could be the same, remove feature/.../xyz.xml
and make sure to only import base.R.drawable.xyz
.如果两个文件实际上可能相同,请删除
feature/.../xyz.xml
并确保仅导入base.R.drawable.xyz
。
If both files have to be different, rename either one and make sure to get your imports correct.如果两个文件必须不同,请重命名其中一个并确保导入正确。
Both modules base
and moduleA
seem to depend on the same AAR.模块
base
和moduleA
似乎都依赖于同一个 AAR。
Instead, put the AAR as a dependency of module base
only.相反,仅将 AAR 作为模块
base
的依赖项。 moduleA
should be able to find the resource through a transitive dependency of module base
. moduleA
应该能够通过 module base
的传递依赖找到资源。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.