0

Does someone know if it's possible, and in which extent, to build different app flavors using the Android Maven Plugin ?

I just saw there was a rename manifest package option in the aapt goal (read in this excellent blog article btw).

Are there any limitations to create 2 flavors of an app if you combine this and some usual maven profiles techniques ? Is there any example somewhere ?

Thanks in advance !

Snicolas
  • 37,840
  • 15
  • 114
  • 173

2 Answers2

1

I have used profiles to achieve this but I have to say that the Gradle flavors are superior in 2 points:

Context

let's say you want to have 2 app with different drawables so you have 2 res folder

  1. Gradle flavor will use the default folders and overwrite anything that comes from the flavor into the default.

  2. Flavors can be build in 1 command into diff directories

Maven partial example:

<profile>
    <id>winter-resources</id>
    <properties>
        <android.res.dir>${project.basedir}/winter-res</android.res.dir>
    </properties>
</profile>

and in the configuration of the android-maven-plugin you would put

<resourceDirectory>${android.res.dir}</resourceDirectory>
Benoit
  • 4,549
  • 3
  • 28
  • 45
  • Do you have any maven example ? Something that could help to compare with Gradle would be a plus, but still could provide a working example for a maven setup ? – Snicolas Nov 13 '13 at 20:32
  • Edited it. the pom is from a closed source project but if you need more help just shoot – Benoit Nov 13 '13 at 20:40
  • Btw I reviewed Gradle and I'm still sticking with maven right now as aar support is in the new 3.8.1-SNAPSHOT. I couldn't make gradle work with sonar what a pitty and had some issues with jenkins but I gotta look more on it later. I love the performance boost gradle has over android-maven but that might change once we refactor android-maven to use AndroidBuilder – Benoit Nov 13 '13 at 20:42
  • Your performance boost is surprising, I just switched to Maven because Gradle was soooo slow to do its forced full-rebuild every time and lack of good Intellij support (they're trying but it's still not there yet). – gleenn May 19 '14 at 09:13
0

https://github.com/bable5/maven-android-flavors/blob/master/pom.xml

I found a pom example using profiles for flavors.

spy
  • 3,199
  • 1
  • 18
  • 26