Skinning Android app with Maven build profiles

主宰稳场 提交于 2019-11-26 16:56:04

问题


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


回答1:


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/




回答2:


Based on the answer from yorkw, this solution works for me:

For each profile, resourceDirectory needs to be added into to the configuration of the android maven plugin.

For example:

<resourceDirectory>${project.basedir}/res-customer1</resourceDirectory> <resourceDirectory>${project.basedir}/res-customer2</resourceDirectory>

etc...



来源:https://stackoverflow.com/questions/9699485/skinning-android-app-with-maven-build-profiles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!