根据本机ABI生成多个Apk [英] Generating Multiple Apk according to the Native ABI
本文介绍了根据本机ABI生成多个Apk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于要在 Play商店上发布的APK大小,我正在构建基于ABI的发布APK.
I am building release apk based on the ABI because of apk size to publish on Play store.
所以我开始为 ABI = armeabi-v7a 进行APK构建,然后构建 ABI = x86和ABI = areambi
所以我的gradle看起来像这样
so my gradle look like this
应用gradle
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.package"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86, armeabi-v7a, and mips.
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "armeabi-v7a"
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk false
}
}
}
所以我的问题
- 我需要为每个ABI在
versionCode 1
中进行更改,因此我应该使用哪个ABI版本代码.
- I need to make changes in
versionCode 1
for each ABI, so which version code for which ABI should I use.
推荐答案
我必须进行2种不同的构建
I have to make 2 different build
版本1:适用于armeabi-v7a
Build 1: for armeabi-v7a
versionCode 21614001
splits {
abi {
enable true
reset()
include "armeabi-v7a"
universalApk false
}
}
内部版本2:适用于x86
Build 2 : for x86
versionCode 61614001
splits {
abi {
enable true
reset()
include "x86"
universalApk false
}
}
已将本机库添加到支持的abi中.
在发布之后,apk Build 1和Build 2一起将向您显示支持的设备.
After that published the apk Build 1 and Build 2 together will show you the supported devices.
这篇关于根据本机ABI生成多个Apk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文