android - How can I specify per flavor buildType sourceSets? -


i've got 2 flavors of app each have own google maps (v1) key debug , release (meaning 4 keys total). i'd know if can specify sourcesets based on buildtype , productflavor. essentially, i'm wondering how can achieve this:

src ├── debug │   └── flavor1 │       └── res │           └── values │               └── gmaps_key.xml ├── release │   └──flavor1 │       └── res │           └── values │               └── gmaps_key.xml 

where gradle use src/<currentbuldtype>/<currentproductflavor>/* part of sourceset.

essentially want if run gradle assembleflavor1debug include under src/main/*, src/flavor1/*, , src/debug/flavor1/*.

my build.gradle super simple:

buildscript {     repositories {         mavencentral()     }         dependencies {         classpath 'com.android.tools.build:gradle:0.5.0'     }    }  apply plugin: 'android'  android {     compilesdkversion 8      productflavors {         flavor1 {             packagename 'com.flavor1'         }         flavor2 {             packagename 'com.flavor2'         }     } } 

any thoughts? or maybe better approach this?

for google maps api integration can check gradle sample code here : https://github.com/shakalaca/learning_gradle_android/tree/master/07_tricks

basically little trick in android.applicationvariants.all during mergeresources phase, , place api key in strings.xml under different flaver/buildtype combination folder.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -