为什么使用armeabi-v7a 代码而不是armeabi 代码?

发布于 2024-11-29 14:14:29 字数 323 浏览 1 评论 0原文

在我当前的项目中,我使用多个 .so 文件。它们位于armeabi 和armeabi-v7a 文件夹中。不幸的是,其中一个 .so 文件大小为 6MB,我需要减小文件大小。我只想使用armeabi 文件并删除armeabi-v7a 文件夹,而不是使用胖APK 文件。

根据NDK文档,armeabi-v7a代码是扩展的armeabi代码,可以包含额外的CPU指令。这一切都超出了我的专业知识,但我质疑为什么人们想要同时拥有armeabi-v7a和armeabi代码。两者都必须有充分的理由,对吗?

在我的测试设备上,这一切似乎都工作正常。它们具有 ARM v7 CPU。可以安全地假设现在一切正常吗?

In my current project I make use of multiple .so files. These are located at the armeabi and armeabi-v7a folder. Unfortunately one of the .so files is a 6MB and I need to reduce file size. Instead of having a fat APK file, I would like to use just the armeabi files and remove the armeabi-v7a folder.

According to the NDK documentation, armeabi-v7a code is extended armeabi code which can contain extra CPU instructions. This all goes beyond my expertise, but I question why one would like to have both armeabi-v7a and armeabi code. There must be a good reason to have both, right?

On my test devices this all seem to work fine. These have ARM v7 CPU's. Is it safe to assume that everything works now?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

铁轨上的流浪者 2024-12-06 14:14:29

取决于您的本机代码的功能,但 v7a 支持硬件浮点运算,这会产生巨大的差异。 armeabi 在所有设备上都能正常工作,但速度会慢很多,并且无法利用较新设备的 CPU 功能。请针对您的特定应用程序进行一些基准测试,但删除 armeabi-v7a 二进制文件通常不是一个好主意。如果您需要减小大小,您可能需要为旧设备 (armeabi) 和新设备 (armeabi-v7a) 提供两个单独的 apk。

更新 2012-09; Google 的 Play 商店终于支持上传不同的 APK(每个 APK 针对不同的 CPU 架构),即所谓的“多个 APK”功能:
https://developer.android.com/google/play/publishing/multiple-应用程序

每个 APK 可能需要有不同的版本代码(即使它们实际上都是相同的版本,只是 CPU 目标不同)。

更新 2023;Google 建议创建“应用程序包”而不是使用“多个 APK”功能:
https://developer.android.com/guide/app-bundle

对于“应用程序捆绑包”,Play 商店可以根据正在下载的设备自动降低下载大小。

Depends on what your native code does, but v7a has support for hardware floating point operations, which makes a huge difference. armeabi will work fine on all devices, but will be a lot slower, and won't take advantage of newer devices' CPU capabilities. Do take some benchmarks for your particular application, but removing the armeabi-v7a binaries is generally not a good idea. If you need to reduce size, you might want to have two separate apks for older (armeabi) and newer (armeabi-v7a) devices.

Update 2012-09; Google's Play Store finally has support for uploading different APKs (each targeting a different CPU architecture), with the so-called "multiple APKs" feature:
https://developer.android.com/google/play/publishing/multiple-apks

Where maybe each APK needs to have a different version code (even if they all are actually the same version, just with different CPU target).

But Update 2023; Google recommends creating "App bundle" instead of using "multiple APKs" feature:
https://developer.android.com/guide/app-bundle

Where for "App bundle", the Play store can automatically bring down the download size, based on the device which's downloading.

厌倦 2024-12-06 14:14:29

EABI = 嵌入式应用程序二进制接口。可执行文件必须符合这样的规范才能在特定的执行环境中执行。它还指定了用于 ARM 架构的工具链之间互操作所需的编译和链接的各个方面。在这种情况下,当我们谈论 armeabi 时,我们谈论的是 ARM 架构和 GNU/Linux 操作系统。 Android 遵循小端 ARM GNU/Linux ABI。

armeabi 应用程序将在 ARMv5(例如 ARM9)和 ARMv6(例如 ARM11)上运行。如果您使用正确的 GCC 选项(如 -mfpu=vfpv3 -mfloat-abi=softfp)构建应用程序,则可以使用浮点硬件,它告诉编译器为 VFP 硬件生成浮点指令并启用软浮点调用约定。 armeabi 不支持硬浮点调用约定(这意味着 FP 寄存器不用于包含函数的参数),但仍然支持硬件中的 FP 操作。

armeabi-v7a 应用程序将在 Cortex A# 设备(例如 Cortex A8、A9 和 A15)上运行。它支持多核处理器,并且支持-mfloat-abi=hard。因此,如果您使用 -mfloat-abi=hard 构建应用程序,许多函数调用将会更快。

EABI = Embedded Application Binary Interface. It is such specifications to which an executable must conform in order to execute in a specific execution environment. It also specifies various aspects of compilation and linkage required for interoperation between toolchains used for the ARM Architecture. In this context when we speak about armeabi we speak about ARM architecture and GNU/Linux OS. Android follows the little-endian ARM GNU/Linux ABI.

armeabi application will run on ARMv5 (e.g. ARM9) and ARMv6 (e.g. ARM11). You may use Floating Point hardware if you build your application using proper GCC options like -mfpu=vfpv3 -mfloat-abi=softfp which tells compiler to generate floating point instructions for VFP hardware and enables the soft-float calling conventions. armeabi doesn't support hard-float calling conventions (it means FP registers are not used to contain arguments for a function), but FP operations in HW are still supported.

armeabi-v7a application will run on Cortex A# devices like Cortex A8, A9, and A15. It supports multi-core processors and it supports -mfloat-abi=hard. So, if you build your application using -mfloat-abi=hard, many of your function calls will be faster.

魄砕の薆 2024-12-06 14:14:29

我想只使用armeabi 文件并删除armeabi-v7a 文件夹,而不是使用胖APK 文件。

相反的是一个更好的策略。如果您将 minSdkVersion 设置为 14 并将您的 apk 上传到 Play 商店,您会发现无论您是否支持 armeabi,您都将支持相同数量的设备。因此,没有任何 Android 4 或更高版本的设备可以从 armeabi 中受益。

这可能就是 Android NDK 根据修订版 r17b 不再支持 armeabi 的原因。 [来源]

Instead of having a fat APK file, I would like to use just the armeabi files and remove the armeabi-v7a folder.

The opposite is a much better strategy. If you have minSdkVersion to 14 and upload your apk to the play store, you'll notice you'll support the same number of devices whether you support armeabi or not. Therefore, there are no devices with Android 4 or higher which would benefit from armeabi at all.

This is probably why the Android NDK doesn't even support armeabi anymore as per revision r17b. [source]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文