Skip to content

Instantly share code, notes, and snippets.

@ph0b
Last active February 12, 2023 07:45
Show Gist options
  • Save ph0b/69586260bc20c58136ef to your computer and use it in GitHub Desktop.
Save ph0b/69586260bc20c58136ef to your computer and use it in GitHub Desktop.
sample build.gradle for generating split APKs per ABI
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig{
minSdkVersion 14
targetSdkVersion 21
versionCode 101
versionName "1.0.1"
}
splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' //select ABIs to build APKs for
universalApk true //generate an additional APK that contains all the ABIs
}
}
// map for the version code
project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5, 'mips64': 6, 'x86': 8, 'x86_64': 9]
android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 1000000 + android.defaultConfig.versionCode
}
}
}
@techradical
Copy link

Hi, i had some cppFlags that were specific for some ARM and some for x86, in the above gradle, how do i specify ABI specific flags?

@aloksharma1
Copy link

aloksharma1 commented Jan 29, 2018

hi , i tried your scheme but uploading on play store is giving me error fully shadow apk on my apk's , you can check more details here

https://stackoverflow.com/questions/48505127/fully-shadow-apk-issue-on-newly-released-app-android-studio/48505267

kindly help, as i am unable to upload my apk on play store until this issue resolve. its a brand new app with no previous versions uploaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment