Sign multiple flavors with different keystores

One of my projects has a lot of flavors, and each flavor has different keystore to sign with. As a result it has very long build.gradle project file. As each flavor need defining separate singningConfig and defining flavor signing on release buildType

After reading couple of articles, i end up with this solution:

Create signs.gradle under project folder:

Apply it in project build.gradle in the begining of the file

apply from: 'signs.gradle'

Add callbacks when signingConfigs and productFlavors is added:

 

The first will call our function with added signing name

The second will set signingConfig for flavor based on loaded config

Keystore information is stored in files named <flavor_name>.info under certs folder under project subfolder. The format of this file is often used to storing signed.properties

Usage

Add flavor configuration

Register signing config with the same name as flavor

Create app1.info file under certs directory with information about the keystore.

Build. Enjoy.

ToDo

Leave a Reply

Your email address will not be published. Required fields are marked *