Search code examples
androidmavenbuildskinningprofiles

Skinning Android app with Maven build profiles


I've got mavenized Android application and customer wants support for the skinning at build time.

For example: mvn clean install -P Developer, mvn clean install -P Customer1, mvn clean install -P Customer2

In other words, different customer needs little bit different set of images, different strings (appName, copyright, etc) and also, some of the elements in layouts should be hidden or shown (Developer profile), so different layouts too.

My first thought was to have folders like res-customer1, res-customer2 in parallel with standard res directory and do the swap in profile definition in pom.xml, also rename it to res, but that doesn't seem to work. I always get original res folder into the build and in this case, duplicates error.

Does this mean that swapping should take place inside of the res? I didn't specify resourceDirectory in configuration of android maven plugin.

I've been googling a lot, but so far, I didn't find anybody with same issue. How to solve it? Is there any general pattern for that?

Many thanks in advance


Solution

  • If you want to use different assets or resources for different buid profiles and if you even want to merge multiple such directories of each build differently, you can follow this great blog post:

    https://ebuddytechblog.wordpress.com/2013/04/08/branded-android-builds-using-maven/