Gradle android build for different processor architectures

As of Android Gradle Plugin version 13 you can now generate seperate APK’s using the new “split” mechanism. You can read about it here.

The default file structure for placing your .so files is:


Note that the name of the .so file is unimportant as long as it has the .so extension.

Then in your Gradle build file:

android {
splits {
abi {
  enable true
  include 'x86', 'armeabi-v7a', 'mips', 'armeabi'
  universalApk false


// map for the version code
ext.versionCodes = ['armeabi-v7a':1, mips:2, x86:3]


android.applicationVariants.all { variant ->
    // assign different version code for each output
    variant.outputs.each { output ->
        output.versionCodeOverride =
            project.ext.versionCodes.get(output.getFilter(OutputFile.ABI)) * 1000000 + android.defaultConfig.versionCode

Note that the version codes above in ext.versionCodes are largely irrelevant, this is here to add a unique offset for each ABI type so version codes do not clash.

Leave a Comment