多模块项目:如果不覆盖,使用哪些模块资源?
Multi module project : Which modules resources are used if not overwritten?
假设我有如下模块:
- app-core
- app-db
- app-ui
- app
app
模块包括所有其他 3 个模块。比方说,除 app
之外的所有模块都定义了一个名为 app_name
的字符串。哪一个赢了?我该如何控制它?
资源将按以下顺序合并:
build variant > build type > product flavor > main source set > library dependencies
因此,当 app
是您的 apk 时,这些资源具有最高优先级,
However, if your build configuration specifies multiple resource folders for a given source set and there are conflicts between those sources, an error occurs and the merge fails because each resource directory has the same priority.
完整的细节在这里:
https://developer.android.com/studio/write/add-resources#resource_merging
假设我有如下模块:
- app-core
- app-db
- app-ui
- app
app
模块包括所有其他 3 个模块。比方说,除 app
之外的所有模块都定义了一个名为 app_name
的字符串。哪一个赢了?我该如何控制它?
资源将按以下顺序合并:
build variant > build type > product flavor > main source set > library dependencies
因此,当 app
是您的 apk 时,这些资源具有最高优先级,
However, if your build configuration specifies multiple resource folders for a given source set and there are conflicts between those sources, an error occurs and the merge fails because each resource directory has the same priority.
完整的细节在这里: https://developer.android.com/studio/write/add-resources#resource_merging