简体   繁体   English

收到此错误“模块'base'和'moduleA'包含具有不同内容的条目'res/drawable/xyz.xml'。”

[英]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.模块basemoduleA似乎都依赖于同一个 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.

相关问题 模块“base”和“instantapp”包含具有不同内容的条目“assets/crashlytics-build.properties” - Modules 'base' and 'instantapp' contain entry 'assets/crashlytics-build.properties' with different content 模块“base”和“AdharVerificationDynamicFeature”包含具有不同内容的条目“assets/crashlytics-build.properties” - Modules 'base' and 'AdharVerificationDynamicFeature' contain entry 'assets/crashlytics-build.properties' with different content 出现错误错误:res / menu / mainMenu.xml:无效的文件名:必须仅包含[a-z0-9_。] - getting error Error:res/menu/mainMenu.xml:invalid file name:must contain only[a-z0-9_.] 在Android.jar.res.drawable中获取XML文件 - Getting at XML files inside Android.jar.res.drawable android.content.res.Resources$NotFoundException:文件 res/drawable-v21/launch_background.xml - android.content.res.Resources$NotFoundException: File res/drawable-v21/launch_background.xml android.content.res.Resources $ NotFoundException异常:来自drawable资源ID的文件res / drawable / my.xml - Exception android.content.res.Resources$NotFoundException: File res/drawable/my.xml from drawable resource ID 出现错误说 - “条目名称 'res/layout/test_toolbar.xml' 碰撞”,同时创建签名的 apk - Getting error says - "Entry name 'res/layout/test_toolbar.xml' collided" while creating signed apk 闪屏错误:android.content.res.Resources$NotFoundException: Drawable - Splash screen error: android.content.res.Resources$NotFoundException: Drawable android.content.res.Resources $ NotFoundException:来自可绘制资源ID#0x7f0200d7的文件res / drawable / ic_customer_toolbar.xml - android.content.res.Resources$NotFoundException: File res/drawable/ic_customer_toolbar.xml from drawable resource ID #0x7f0200d7 KitKat specific- android.content.res.Resources $ NotFoundException:来自可绘制资源ID的文件res / drawable / list_selector_white.xml - KitKat specific- android.content.res.Resources$NotFoundException: File res/drawable/list_selector_white.xml from drawable resource ID
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM