Skip to content

Instantly share code, notes, and snippets.

@YeJiashen
Created March 20, 2019 10:35
Show Gist options
  • Save YeJiashen/354e7dfd214c8213a7ab123bfeece125 to your computer and use it in GitHub Desktop.
Save YeJiashen/354e7dfd214c8213a7ab123bfeece125 to your computer and use it in GitHub Desktop.
缺少某些架构的so库但是强行生成对应架构的apk防止安装包错的方法
ext.abiCodes = ['arm64-v8a':2, armeabi:3, 'armeabi-v7a':4, mips:5, mips64:6, x86:7, 'x86_64':8]
android {
splits {
abi {
enable true
universalApk true
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def abiVersionCode =
project.ext.abiCodes.get(output.getFilter("ABI"))
if (abiVersionCode != null) {
output.versionCodeOverride = abiVersionCode
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment