Skip to content

Instantly share code, notes, and snippets.

@gpeal
Created May 22, 2018 02:01
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save gpeal/d68e4fc1357ef9d126f25afd9ab4eee2 to your computer and use it in GitHub Desktop.
Save gpeal/d68e4fc1357ef9d126f25afd9ab4eee2 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")
]
@gpeal
Copy link
Author

gpeal commented Apr 25, 2021

@ivanalvarado Hi Ivan, unfortunately, I don't work at Airbnb anymore and don't have access to the latest code. Every time I work with gradle, it requires a lot of trial and error and Googling (you are not alone) so I won't be able to provide more specific code either.

I belive this code was at the project level app.gradle file though and flavors are used for application modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment