问题描述
所以我有一段时间没有发布了.Android Studio 过去只生成一个 apk,这是一个发布版本.这次它生成了 3 个,如下所示:
So I haven't released in a while. Android Studio used to generate only one apk, which was a release version. This time it generated 3 like the following:
1.app-armeabi-v7a-release.apk
2.app-x86-release.apk
3.app-universal-release.apk
我将假设我想在 Google Play 商店中使用通用版本.
但是有人可以分解每个细节吗?
I'm going to assume that I want to use the universal one for the Google Play Store.
But can someone break down the specifics of each one?
推荐答案
每个生成的 apk 都是针对特定 CPU 架构的.它们通常是在使用 apk 中的本机库时生成的(更多信息请参见 添加项目中的 C 和 C++ 代码).您可以在 ABI 管理 中了解它,摘录如下:
The generated apks each is for specific CPU Architecture. They usually are generated when using a native library inside the apk (more at Add C and C++ Code to Your Project). You can read about it in ABI Management, here the excerpt:
不同的 Android 手机使用不同的 CPU,这反过来又支持不同的指令集.CPU和指令的每种组合集有自己的应用程序二进制接口,或 ABI.ABI非常精确地定义了一个应用程序的机器代码是怎样的应该在运行时与系统交互.您必须指定一个适用于您希望应用使用的每种 CPU 架构的 ABI.
Different Android handsets use different CPUs, which in turn support different instruction sets. Each combination of CPU and instruction sets has its own Application Binary Interface, or ABI. The ABI defines, with great precision, how an application's machine code is supposed to interact with the system at runtime. You must specify an ABI for each CPU architecture you want your app to work with.
除了app-universal-release.apk
之外,每个都将包含架构的特定指令.
Each will contain specific instruction for the Architecture, except the app-universal-release.apk
.
app-armeabi-v7a-release.apk
适用于 v7-a ARM 设备
app-x86-release.apk
适用于 x86"或IA-32"
app-universal-release.apk
包含 app-armeabi-v7a-release.apk
和 app-x86-release 中的具体指令.APK
app-universal-release.apk
contains both of the specific instruction in app-armeabi-v7a-release.apk
and app-x86-release.apk
您可以只使用通用的,但如果生成的 apk 太大,您可能不想使用它.用户倾向于避免在 Play 商店中使用大型应用程序.因此,要克服这个问题,您需要将 apk 分解为特定的 apk,以便生成的 apk 更小.
You can use just the universal one, but you probably will not want to use it if the generated apk is too big. User tend to avoid a big application in the play store. So, to overcome this, you need to break the apk to a specific one so the resulted apk is smaller.
如果您不想使用通用的,则需要将每个特定的 apk 上传到 Play 商店.当用户访问 Play 商店中的应用程序时,将为其提供与其设备 CPU 类型匹配的特定 apk.
If you don't want to use the universal one, then you need to upload each of the specific apk to the Play Store. When user visit the application in the Play Store, he/she will be served with the specific apk matching with his/her device CPU type.
这篇关于Android studio 以前生成 1 个 release apk,现在是 3 个.它们每个是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!