I am currently working on an application that has 5 options, and this is part of my build.gradle files that matter:
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 to the file, but mostly it.
Question: I have a requirement to provide each of these flavors with a different set of asset files in the resource folder, which will create a different apk file but have the same package name. These apk files will be uploaded to the Google game as the same application, but for different regions. Therefore, the package name must remain unchanged. So basically I need to create a mechanism that instead of 5 flavors will create 10 flavors when each of them will have the same package name, but in a different folder with resources. How can this be done using gradle?
I tried to implement this using BuildTypes, for example:
buildTypes { release { signingConfig signingConfigs.release sourceSets.main.assets.srcDirs = ['assets'] } releaseAlt { signingConfig signingConfigs.release sourceSets.main.assets.srcDirs = ['assetsalt'] } }
But for some reason, releaseAlt also accepts files located in the assets directory rather than in the assetsalt directory. Can someone point me in the right direction regarding this? Thanks in advance.
source share