Skip to content

Instantly share code, notes, and snippets.

@Michcioperz
Created September 23, 2017 19:14
Show Gist options
  • Save Michcioperz/061a5244a4318e0ba1a8903e2e6077ea to your computer and use it in GitHub Desktop.
Save Michcioperz/061a5244a4318e0ba1a8903e2e6077ea to your computer and use it in GitHub Desktop.
ext.postBuildExtras = {
android.splits.density.enable = true
android.splits.density.compatibleScreens = ['small', 'normal', 'large', 'xlarge']
ext.densityCodes = ['ldpi': 1, 'mdpi': 2, 'hdpi': 3, 'xhdpi': 4, 'xxhdpi': 5, 'xxxhdpi': 6]
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def baseDensityVersionCode = project.ext.densityCodes.get(output.getFilter("DENSITY"))
if (baseDensityVersionCode == null) { baseDensityVersionCode = 0 }
output.versionCodeOverride = android.defaultConfig.versionCode * 10 + baseDensityVersionCode
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment