Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gradle flavors and resources example
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 23
versionName "7.1.0"
}
signingConfigs {
signed {
storeFile file("")
storePassword ""
keyAlias ""
keyPassword ""
}
}
buildTypes {
debug {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
release {
signingConfig signingConfigs.signed
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
main {
manifest.srcFile '/src/main/AndroidManifest.xml'
java.srcDirs = ['/src/main/java','.apt_generated']
aidl.srcDirs = ['/src/main/aidl','.apt_generated']
res.srcDirs = ['/src/main/res']
assets.srcDirs = ['/src/main/assets']
}
withAds {
java.srcDirs = ['/src/with_ads/java','.apt_generated']
}
noAds {
java.srcDirs = ['/src/no_ads/java','.apt_generated']
}
rebuild {
java.srcDirs = ['/src/rebuild/java','.apt_generated']
manifest.srcFile '/src/rebuild/AndroidManifest.xml'
res.srcDirs =
[
'/src/rebuild/res/layouts/layouts_category1',
'/src/rebuild/res/layouts/layouts_category2',
'/src/rebuild/res/values'
]
}
}
flavorGroups "ads", "version"
productFlavors {
withAds {
flavorGroup "ads"
}
noAds {
flavorGroup "ads"
}
old {
flavorGroup "version"
}
rebuild {
flavorGroup "version"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment