Skip to content

Instantly share code, notes, and snippets.

@h4ck4life
Forked from gpeal/build.gradle
Created June 20, 2018 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h4ck4life/d0909c62dceeed064c1a8bd31ab62360 to your computer and use it in GitHub Desktop.
Save h4ck4life/d0909c62dceeed064c1a8bd31ab62360 to your computer and use it in GitHub Desktop.
Airbnb Gradle Flavors
...
apply from: './flavors.gradle'
...
android {
buildTypes {
productFlavors {
project.flavors.each { flavor, config ->
"$flavor" {
dimension 'scope'
if (flavor != 'full') {
versionNameSuffix ".$flavor"
}
}
}
}
}
}
...
class FlavorOptions {
final String entryModule
FlavorOptions(String entryModule) {
this.entryModule = entryModule
}
}
project.ext.flavors = [
full: new FlavorOptions(":flavor.full"),
foo: new FlavorOptions(":flavor.foo")
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment