Skip to content

Instantly share code, notes, and snippets.

@pratheepchowdhary
Created May 13, 2018 13:54
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 pratheepchowdhary/d1834738ae9fc710547327064f5a312a to your computer and use it in GitHub Desktop.
Save pratheepchowdhary/d1834738ae9fc710547327064f5a312a to your computer and use it in GitHub Desktop.
import com.android.build.OutputFile
android {
splits {
//...
}
// Map for the version code that gives each ABI a value.
def abiCodes = ['x86':1, 'x86_64':2, 'armeabi-v7a':3, 'arm64-v8a':4]
// APKs for the same app that all have the same version information.
android.applicationVariants.all { variant ->
// Assigns a different version code for each output APK.
variant.outputs.each {
output ->
def abiName = output.getFilter(OutputFile.ABI)
output.versionCodeOverride = abiCodes.get(abiName, 0) * 100000 + variant.versionCode
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment