Article Directory
I. Introduction
Different Android
different mobile phone use CPU
, and different CPU
different instruction set support, CPU
each in combination with the instruction set has a unique application binary interface, that is ABI(全称:ApplicationBinary Interface)
.
Two, Android's CPU architecture
Android
The system currently supports the following seven different CPU
architectures
CPU architecture | description | time |
---|---|---|
ARMv5 | The 5th generation ARM v5TE, using software floating point calculation, compatible with all ARM devices, strong versatility, slow speed | |
ARMv7 | The 7th generation ARM v7, using hardware floating point operations, with advanced extended functions | Since 2010 |
x86 | intel 32 bit, generally used for tablet | Since 2011 |
x86_64 | Intel 64 bit, generally used for tablets | Since 2014 |
ARMv8 | The 8th generation, 64-bit, contains AArch32, AArch64 two execution states corresponding to 32, 64bit | Since 2014 |
MIPS | Less contact | |
MIPS64 | Less contact | Since 2014 |
Three, the correspondence between CPU and ABI
CPU architecture (vertical)\API (horizontal) | armeabi | armeabi-v7a | arm64-v8a | x86 | x86_64 | mips | mips64 |
---|---|---|---|---|---|---|---|
ARMv5 | stand by | ||||||
ARMv7 | stand by | stand by | |||||
x86 | stand by | stand by | stand by | ||||
x86_64 | stand by | stand by | stand by | ||||
ARMv8 | stand by | stand by | stand by | ||||
MIPS | stand by | ||||||
MIPS64 | stand by | stand by |
Android
Application support ABI
depending APK
located lib/ABI目录
in .so文件
, which ABI
may be the above-mentioned seven kinds of ABI
a medium of.
When an application is installed on a device, only the files CPU
corresponding to the architecture supported by the device .so
will be installed.
Select ABI
when there will be apriority, The use of different supported ABI
will show different performance.
For example, on the
x86
device, libs/x86目录
if a .so
file exists in the file, it will be installed, if it does not exist, armeabi-v7a
the .so
file in the file will be selected , and if it does not exist, armeabi
the .so
file in the directory will be selected .
x86
The device can run the ARM
type function library well, but there is no guarantee that it will 100%
not happen crash
, especially for old devices. The function library that the
64位
device ( arm64-v8a, x86_64, mips64
) can run 32位
, but 32位
runs in mode, and the version and components running on the 64位
platform will lose the performance optimized for the purpose ( etc.).32位
ART
Android
64位
ART,webview,media
Fourth, the information contained in a typical ABI
Use of a machine code CPU
instruction set.
2 The byte order of memory storage and loading at runtime.
3 The format of executable binary files (such as programs and shared libraries) and the types of content they support.
4 Various conventions used to resolve data between content and the system. These conventions include alignment restrictions, and how the system uses the stack and registers when calling functions.
5 List of function symbols available for machine code at runtime-usually from a very specific set of libraries.
Five, .so file naming convention
.so
The name must have lib
a prefix or apk
unzip / install the phone when not put libs\API目录
in .so
copy to /data/data/com.你的应用包名/lib
the next.
6. Storage location of .so files
The corresponding ABI
binary files (such as .so
files), corresponding to put ABI目录
in
1 Android Studio project
on jniLibs/ABI目录中
(of course, can be achieved by build.gradle
setting file jniLibs.srcDir
attributes specify your own)
as jniLibs/armeabi/libxxx.so
2 Eclipse project
on libs/ABI目录中
(which is the ndk-build
command generated by default .so
directory files )
Such as libs/armeabi/libxxx.so
3
AAR
is located in the compressed package in the AAR compressed packagejni/ABI目录中
(the .so
file will be automatically included in the reference AAR
compressed package APK
)
such as jni/armeabi/libxxx.so
4 is the path in the APK and the
final APK
file lib/ABI目录中
such aslib/armeabi/libxxx.so