Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Flavors - Separate drawable directory for each app?

Is it possible to have the same codebase but a different drawable directory for each app?

Basically i want to have the same app multiple times, just rebranded, so everything can be identical except for the images in the drawable folders.

Any ideas?

I want my directory structure to look like this:

manifest
java
assets
res
   anim
   animator
   drawables
     main
        drawable
           logo.png
           background.png
           xxx.png
           yyy.png
     flavor1
        drawable
           logo.png
           background.png
     flavor2
        drawable
           logo.png
           background.png
   layout
   menu
   values
   xml
like image 915
Nickmccomb Avatar asked Jan 06 '23 19:01

Nickmccomb


1 Answers

Yep. This is one of the Main features of android flavors. All you need to do is create a new folder at the same level as your "main" directory and name it as the desired favor. In this new folder you need to copy the structure and use the same name for the drawables you want to override. Gradle will pick up these resources first if present but will take any not present from the Main folder by default.

like image 183
Pato94 Avatar answered Feb 04 '23 10:02

Pato94