A great tip for structuring large projects

When developing large Android projects, one annoyance is that the layouts for all screens need to go into the single /layouts directory, all images into the various /drawable-xxx directories, etc.  For a big app this leads to resource directories cluttered with files.  For example the current app I’m working on has 44 xml files in the /layouts directory alone.  This makes it very hard to find things.

The google developer experts blog has a great tip on using gradle with multiple resource folders:  https://medium.com/google-developer-experts/android-project-structure-alternative-way-29ce766682f0#.k5h2lx5n6

The key part is using multiple source sets in your build.gradle:

sourceSets {
    main {
        res.srcDirs = [

For larger projects this seems like a great way of doing things, and I will definitely be making use of it in the future.