Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found myself in a similar situation.</p> <p>I had a single app but built for different customers (having specific customization like resources, properties...). I eventually decided to manage the whole thing using maven.</p> <p>What I've done is creating a "config" folder in my codebase and inside it I've added pro customer a folder containing the properties, string, pictures related to him.</p> <p>My structure is something like this:</p> <pre><code>MyAppBase src/ build/ BaseAndroidManifest.xml ... config/ customerA/ logo.png customerA.xml customerA.properties customerB/ customerC/ ... </code></pre> <p>Using maven artifacts for copying, move, replace I've then managed to build customer specific apk in the following way:</p> <p>1) Create a temporary customer specific source folder where all code is copied to</p> <pre><code>&lt;copy todir="src_${customer}"&gt; &lt;fileset dir="src"/&gt; &lt;/copy&gt; </code></pre> <p>2) Rename packages and imports</p> <pre><code>&lt;!-- Rename main package --&gt; &lt;move file="src_${customer}/ch/wizche/myapp" tofile="src_${customer}/ch/wizche/${customer}"/&gt; &lt;!-- Replace package imports with the newly one --&gt; &lt;replace dir="src_${customer}/" value="ch.wizche.${customer}"&gt; &lt;include name="**/*.java"/&gt; &lt;replacetoken&gt;ch.wizche.myapp&lt;/replacetoken&gt; &lt;/replace&gt; </code></pre> <p>3) Replace specific resources based on the customer</p> <pre><code>&lt;!-- Copy images icon to the drawable folder --&gt; &lt;copy file="./configs/${customer}/ic_launcher_l.png" tofile="./res/drawable-ldpi/ic_launcher.png" overwrite="true" verbose="true"/&gt; &lt;copy file="./configs/${customer}/ic_launcher_m.png" tofile="./res/drawable-mdpi/ic_launcher.png" overwrite="true" verbose="true"/&gt; </code></pre> <p>4) Replace "Template" AndroidManifest and injecting customer versions, names, ...</p> <pre><code> &lt;copy file="./BaseAndroidManifest.xml" tofile="./AndroidManifest.xml" overwrite="true" verbose="true"/&gt; &lt;replace file="./AndroidManifest.xml" value="ch.wizche.${customer}" token="ch.wizche.myapp"/&gt; &lt;replace file="./AndroidManifest.xml" value="android:versionCode="${versionCode}" token="android:versionCode="1"/&gt; </code></pre> <p>5) Signing using customer alias</p> <p>6) Building APK</p> <p>7) Deleting temporary customer folder</p> <p>So, to build a customer specific app, I just need to:</p> <pre><code>mvn install -Dcustomer=customerA -P release </code></pre> <p>Hope this may give you some inputs.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload