简体   繁体   English

Android,风味,风味,风味和风味

[英]Android, flavors, flavors, flavors and flavors

So as you can see from the title I have a problem with duplicates. 因此,正如您从标题中看到的那样,我有重复的问题。

You are not allowed to have the same file defined in your flavor and your main directory. 您不允许在自己的口味和主目录中定义相同的文件。 But you are allowed doing this with xml resources. 但是您可以使用xml资源执行此操作。

So how does it works? 那么它是如何工作的呢? For example, my build variant is RedStagingDebug , and I have the main_menu_layout.xml defined in 3 folders: 例如,我的体型变化是RedStagingDebug,我有3个文件夹中定义的main_menu_layout.xml:

  • main/res/layout/main_menu.xml main / res / layout / main_menu.xml
  • red/res/layout/main_menu.xml 红色/res/layout/main_menu.xml
  • debug/res/layout/main_menu.xml 调试/res/layout/main_menu.xml

Which file will be used in my build and why? 我的构建中将使用哪个文件,为什么?

Which file will be used in my build 我的构建中将使用哪个文件

debug/res/layout/main_menu.xml will be used 将使用debug/res/layout/main_menu.xml

and why? 为什么呢?

Because the documentation says so . 因为文档中是这样说的 Build types trump product flavors, which trump main , which trump resources from library projects. 构建类型胜过产品风味,产品风味胜过main风味,而图书馆风味则胜过资源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM