Search code examples
androidmoduleresourcesandroid-resources

Multi module project : Which modules resources are used if not overwritten?


Let's say I have modules like following:

  • app-core
  • app-db
  • app-ui
  • app

The app module includes all 3 other modules. Let's say, all modules but app define a string with the name app_name. Which one does win? How can I control this?


Solution

  • The resources will be merged in this order:

    build variant > build type > product flavor > main source set > library dependencies

    So when app is your apk those resources have highest priority,

    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.

    full details are here: https://developer.android.com/studio/write/add-resources#resource_merging