Skip to content

Instantly share code, notes, and snippets.

@NickJian
Created May 23, 2017 09:02
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 NickJian/cc32413ee27c1909ed7e60a4a14a0a73 to your computer and use it in GitHub Desktop.
Save NickJian/cc32413ee27c1909ed7e60a4a14a0a73 to your computer and use it in GitHub Desktop.
// Map for the version code that gives each ABI a value.
ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, 'x86': 3]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
// Stores the value of ext.abiCodes that is associated with the ABI for this variant.
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
// Assigns a different version code for each output APK other than the universal APK.
if (baseAbiVersionCode != null) {
// the value '1000' here total depend on your version code rule.
// if CI build code could be higher than 1000, you should modiy the value accordingly.
output.versionCodeOverride = baseAbiVersionCode * 1000 + variant.versionCode
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment