Skip to content

Instantly share code, notes, and snippets.

@mhmtk
Forked from Takhion/build.gradle
Created October 11, 2017 15:58
Show Gist options
  • Save mhmtk/78e22a2653862c4f4f1036cf0c7fb1a7 to your computer and use it in GitHub Desktop.
Save mhmtk/78e22a2653862c4f4f1036cf0c7fb1a7 to your computer and use it in GitHub Desktop.
def buildConfigAndResStringField(variant, name, value) {
variant.resValue 'string', name.toLowerCase(), value
variant.buildConfigField 'String', name, "\"$value\""
}
afterEvaluate {
android.applicationVariants.all { variant ->
variant.resValue 'string', 'application_id', variant.applicationId
buildConfigAndResStringField variant, "ACCOUNT_TYPE", variant.applicationId
buildConfigAndResStringField variant, "CONTENT_AUTHORITY", variant.applicationId + ".provider"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment