错误表现
aapt2工具构建是提示
resource 'drawable/abc_menu_hardkey_panel_mtrl_mult' has a conflicting value for configuration (xxhdpi-v4).
问题原因
drawable-hdpi与drawable-hdpi-v4文件夹下具有相同属性名的文件,导致aapt2生成R文件时报错,导致打包报错。
分析
drawable-hdpi-v4中的资源本身是drawable-hdpi与drawable-v4资源合并的,所以如果drawable-hdpi-v4中存在与drawable-hdpi或者drawable-v4重名的文件的话,会导致aapt2编译报错。
解决
在aapt2编译之前进行程序判断,删除或者合并drawable-hdpi-v4中与drawable-v4中的重名文件。

文章描述了在使用aapt2工具构建Android项目时遇到的资源冲突问题,具体表现为drawable-hdpi与drawable-hdpi-v4文件夹下的资源文件名称冲突。冲突原因是drawable-hdpi-v4中的资源与drawable-hdpi或drawable-v4中的资源重名。解决方法是在编译前通过程序判断并处理这些重名文件,避免aapt2报错。

7439

被折叠的 条评论
为什么被折叠?



