'Cleaning flavor paths for different build types

I have about 8 flavours in my app, plus the default main flavour. I want to have a different icon for each flavor but also a different icon for each build, eg debug, demo, release.

The folder structure, I believe, means I have to create mutliple folders as follows:

main
    -res
        -mipmap
flavor1
    -res
        -mipmap
flavor1Debug
    -res
        -mipmap
flavor1Demo
    -res
        -mipmap
flavor2
    -res
        -mipmap
flavor2Debug
    -res
        -mipmap
flavor2Demo
    -res
        -mipmap

But I want:

main
    -res
        -mipmap
flavor1
    -debug
        -res
            -mipmap
    -demo
        -res
            -mipmap
    -production
        -res
            -mipmap
flavor2
    -debug
        -res
            -mipmap
    -demo
        -res
            -mipmap
    -production
        -res
            -mipmap

This is so I have each flavors assets inside one folder per flavor, instead of creating multiple folders for each flavor + build.

Is this possible? I thought it worked like this as standard, but maybe I need to change my sourceSets?

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source