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 beggining of the file
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
Remove requirement to put signingConfig with flavor name. It should do this automatically when flavor is registered