Currently I'm working on an application that has 5 flavors and this is the part of my build.gradle files that matters:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.0'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
signingConfigs {
release {
storeFile file("")
storePassword "password"
keyAlias "alias"
keyPassword "password"
}
}
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 20
applicationId 'application.package'
signingConfig signingConfigs.release
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
productFlavors {
flavor1{
applicationId 'com.flavor1.package'
}
flavor2{
applicationId 'com.flavor2.package'
}
flavor3{
applicationId 'com.flavor3.package'
}
flavor4{
applicationId 'com.flavor4.package'
}
flavor5{
applicationId 'com.flavor5.package'
}
}
}
dependencies {
compile project(':SDK')
}
I had to make some changes in the file, but basically this is it.
The question: I have a requirement to provide for each one of those flavors a different set of assets files in the assets folder that will create a different apk file but will have the same package name. Those apk files will be uploaded to the Google play as the same application but for different regions.
So the package name have to stay the same. So basically I need to create a mechanism that instead of 5 flavors will created 10 flavor when every two of them have the same package name but a different assets folder. How can this be done using gradle?
I have tried implementing this using BuildTypes like so:
buildTypes {
release {
signingConfig signingConfigs.release
sourceSets.main.assets.srcDirs = ['assets']
}
releaseAlt {
signingConfig signingConfigs.release
sourceSets.main.assets.srcDirs = ['assetsalt']
}
}
But for some reason the releaseAlt also takes the files located in the assets directory and not the assetsalt directory.