dsman
dsman

Reputation: 1

Android build automation with multiple app edition

I know build automation can be done in Jenkins and I can follow some tutorials for it.

But our app is different. We are providing white labelled app service. Kind of App-As-A-Service. So we have to change few thing when we build app for different customer from same codebase . Ie. Change app icon, change splash screen, put some customer id somewhere etc.

So how do we achieve this ?

Upvotes: 0

Views: 398

Answers (2)

Ali Maddi
Ali Maddi

Reputation: 339

As Hermann Poilpre explained you must use flavor in the gradle script.

After that you needs setting the jenkins web application. For doing that, go to the jenkins web application. In the jenkins after click on the "configure" option in the project folder, choice the "General" tab. You can add Parameter to this tab by clicking on the "Add Parameter" Button. If you don't have this option, probably you needs install appropriate plugins.

enter image description here

You can add two "Choice Parameter" one of them for flavor and another for build variant like release or debug.

after adding "Choice Parameter" you can specified choices like "Release" , "Debug" and so on.

enter image description here

Finally in the "Build" tab in the "Invoke Gradle Script" select "Use Gradle Wrapper" radio button and past command bellow in the "Tasks" field :

clean assemble$MARKETS$BUILD_VARIANTS

As you can see in the picture follow :

enter image description here

Now you can choice flavor and build variant for build task!

Upvotes: 0

Hermann Poilpre
Hermann Poilpre

Reputation: 96

Just create a flavor per customer with gradle. Take a look at the documentation :

http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Product-flavors

For example, you can configure different package name for each flavor if you put this in your build.gradle :

productFlavors {
    flavor1{
        applicationId = "com.app.flavor1"
        versionCode 31
        versionName "3.13"
    }
    flavor2{
        applicationId = "com.app.flavor2"
        versionCode 1
        versionName "1.0"
    }
}

You can have specific files per flavor you having a folder per flavor in your src folder, with for example a specific icon in the res subfolder :

src
----Flavor1
--------res
------------drawable
----------------ic_launcher.png
----Flavor2
--------res
------------drawable
----------------ic_launcher.png

Then you can build an APK for a specific flavor like this :

./gradlew assembleFlavor1Release

Upvotes: 1

Related Questions