为什么Android无法处理Project和Library之间的资源名称冲突? [英] Why Android cannot deal with Resources name conflict between Project and Library?

查看:150
本文介绍了为什么Android无法处理Project和Library之间的资源名称冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由库B引用的项目A,A和B具有相同的名称和类型,但是它们的值不同.我认为aapt应该处理此问题,以确保项目和库访问正确的值.除了重命名项目或库中的所有资源之外,我还应该怎么做才能解决此问题?

I have a project A that referenced by Library B, A and B have the same name and type, but their value are different. I think aapt should deal with this issue that make sure project and library access the correct value. besides renaming all the resource in project or library, what else should I do to solve this problem?

推荐答案

构建系统有意使所有项目资源都覆盖在库资源之上.这样做是为了能够根据使用该库的应用程序不同地自定义库资源.

The build system intentionally makes all project resources overlay on top of the library resources. This is done on purpose to be able to customize a library resource differently depending on the app using it.

如果您想在不知情的情况下防止这种情况的发生,我们始终建议用户在库资源中使用前缀.

If you want to prevent this happening without your knowledge we have always recommended users to use prefix in the library resources.

在这一点上改变行为会破坏很多人的项目.我们已经考虑过使其成为一个选项,但是它不会在新的构建系统完成之前发生.

Changing the behavior at this point would break many, many people's projects. We've looked at making it an option, but it won't happen before the new build system is finished though.

这篇关于为什么Android无法处理Project和Library之间的资源名称冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆