Skip to content

Instantly share code, notes, and snippets.

@igorwojda
Last active February 26, 2018 13:45
Show Gist options
  • Save igorwojda/d2b2c3b9db7fe64bc3fb6228789c810d to your computer and use it in GitHub Desktop.
Save igorwojda/d2b2c3b9db7fe64bc3fb6228789c810d to your computer and use it in GitHub Desktop.
Configure apk split version codes
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