Created
May 23, 2017 09:02
-
-
Save NickJian/cc32413ee27c1909ed7e60a4a14a0a73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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