Armeabi-v7a,arm64-v8a,x86有什么区别?

我正在 Kivy 上开发一个 Android 应用程序,我正在使用 Buildozer 编译一个 APK 文件。 在 Buildozer 规范文件中,有一个设置 android.arch = armeabi-v7a,我不明白这一点。

此外,当我使用命令 buildozer -v android debug生成 APK 文件并使用命令 adb install bin/<appname>.apk安装它时,它没有在我的 Android 手机上打开。

207188 次浏览

These are CPU instruction sets. Mostly you don't have to worry about it, the default is fine, but I've been meaning to add something to the docs about it due to some recent changes.

Basically, a given Android device might have an arm or an x86 cpu (or even something else but that's not important), these are just different architecture types from different manufacturers. Arm cpus are most common, but x86 is not unusual. When you compile code, the output depends on the architecture target. When you build a Kivy app, you specify one of the architectures and then the app will only work on that type of the device. If you want to support all devices, you can compile multiple APKs to distribute - the Play store will let you upload more than one, and will send each device the right one.

Within a given architecture type there are multiple versions. armeabi-v7a is the older target, for 32 bit arm cpus, almost all arm devices support this target. arm64-v8a is the more recent 64 bit target (similar to the 32-bit -> 64 bit transition in desktop computers). I think most new devices are 64 bit, but not sure. arm64-v8a devices can run code compiled against armeabi-v7a, it's backwards compatible.

As of later this year, the Play store will require you to upload an arm64-v8a APK as the minimum, because this gives the best support for newer devices. You will also be able to upload other APKs to support other device types.

That isn't quite the full story: some x86 devices have a special library that lets them run code compiled for arm devices. I'm not sure how widespread this is, but it seems pretty common.

For your app issue, use adb logcat to see what's wrong.

To be clear, these are not instruction sets. They are ABIs, which compile into instruction sets. Most devices today are arm64-v8a, the really cheap devices are armeabi-v7a to save cost, and almost none are x86 or x86_64.

e.g. The armeabi-v7a ABI compiles to armeabi, thumb-2 and VFPv3-D16 instruction set, but arm64-v8a ABI compiles to AArch64 instruction set.

Supported ABIs table 1 from https://developer.android.com/ndk/guides/abis

Each combination of CPU and instruction set has its own Application Binary Interface (ABI). An ABI includes the following information:

The CPU instruction set (and extensions) that can be used. The endianness of memory stores and loads at runtime. Android is always little-endian. Conventions for passing data between applications and the system, including alignment constraints, and how the system uses the stack and registers when it calls functions. The format of executable binaries, such as programs and shared libraries, and the types of content they support. Android always uses ELF. For more information, see ELF System V Application Binary Interface. How C++ names are mangled. For more information, see Generic/Itanium C++ ABI. source