当前位置:网站首页>Talking about the CPU type of anroid device and the placement directory of so files
Talking about the CPU type of anroid device and the placement directory of so files
2022-07-23 13:42:00 【iningwei】
In the early Android The system almost only supports ARMv5 Of CPU framework . Now there are seven kinds :ARMv5,ARMv7 ( from 2010 From the year onwards ),x86 ( from 2011 From the year onwards ),MIPS ( from 2012 From the year onwards ),ARMv8,MIPS64 and x86_64 ( from 2014 From the year onwards ), Each of these CPU Architecture is associated with one ABI.
ABI namely Application Binary Interface, The binary interface is defined ( such as so file ) Interaction rules , To apply to different CPU. stay Android On the system , every last CPU Architecture corresponds to one ABI.
Android ABI
Android At present, the following seven are supported ABI:armeabi、armeabi-v7a、arm64-v8a、x86、x86_64、mips、mips64. Mainstream ABI Include :
- armeabiv-v7a: The first 7 Generation and above ARM processor .2011 year 15 Most of the production after the month Android All the devices use it
- arm64-v8a: The first 8 generation ,64 position ARM processor , Few devices , samsung Galaxy S6 Is one of them
- armeabi: The first 5 generation 、 The first 6 Generation ARM processor , Early mobile phones used more
- x86: Flat 、 Simulators are used a lot (2011 From the year onwards )
- x86_64: 64 A bit of a flat (2014 From the year onwards )
mips and mips64 Rarely used , You can ignore
NDK
NDK What is it ? When your Android Used in Engineering C/C++ Code will be used NDK This development kit is used for development .
NDK namely Native Development Kit, Belong to Android, And Java No direct connection , Is a group that allows you to Android Rapid development in application C/C++ Dynamic library , And automatically so Packaged with the application into apk.NDK yes Android To realize JNI The means of ,JNI namely Java Native Inteface bring Java With other local languages ( Such as C/C++) Interact .
NDK I used to support mips,mips64,armeabi, But in NDK r17 Removed the for these ABI Support for .

because NDK Forward compatible ( front ,forward, future ), Recommended app Of minsdkVersion Corresponding compilation platform , Not the latest .
ABI And CPU
majority CPU All support multiple ABI, But for the best performance , Best use CPU The main ABI. As there are many ABI( such as so file ), Will install the best ABI, Others will not be installed .
64 Bit device (arm64-v8a, x86_64, mips64) Be able to run 32 Bit so library . But in order to 32 Bit mode runtime , Will be lost for 64 Bit optimized performance characteristics (ART, WebView, Media, etc.).
Many devices support more than one ABI, for example ARM64 and x86 The equipment can also run at the same time armeabi-v7a and armeabi The binary package of . But it is better to provide binary packages for specific platforms , In this case, there is one less simulation layer ( for example x86 Simulate on the device arm Virtual layer of ), For better performance ( Thanks to recent architecture updates , For example, hardware fpu, More registers , Better vectorization, etc ).
x86 On the device , choice ABI The priority of the
1,libs/x86 If it exists in the directory .so Word of the file , Will be installed .
2, If it doesn't exist , Will choose armeabi-v7a Medium .so file .
3, If it doesn't exist , select armeabi In the directory .so file .
arm On the device CPU yes arm64-v8a,ABI The priority of the svg
1, If it's a cell phone CPU yes arm64-v8a, Preference arm64-v8a Medium .so file .
2, If it doesn't exist , Will choose armeabi-v7a Medium .so file .
3, If it doesn't exist , select armeabi In the directory .so file .
arm On the device CPU yes armeabi-v7a,ABI Priority tool
1, If it's a cell phone CPU yes armeabi-v7a, Preference armeabi-v7a Medium .so file .
2, If it doesn't exist , Will choose armeabi Medium .so file .
so Where should the document be placed
To configure so The advice of
in the light of armeabi and armeabi-v7a Two kinds of ABI
Method 1: because armeabi-v7a Instruction set compatibility armeabi Instruction set , So it is acceptable to lose some application performance , At the same time, I don't want to keep two copies of the Library , You can remove armeabi-v7a Directory and the library files under it , Only keep armeabi Catalog ; such as Apk Use third party's so Only armeabi This kind of ABI when , Consider removing Apk in lib Under the table of contents armeabi-v7a Catalog .
Method 2: stay armeabi and armeabi-v7a Put one copy in each directory so.
in the light of x86
Currently on the market x86 Model , For compatibility arm Instructions , Basically, they are built-in libhoudini modular , That is, binary transcoding support , This module is responsible for ARM The command is converted to x86 Instructions , So if it's out of Apk Package size considerations , And it can accept some performance loss , You can choose to delete x86 The library catalog ,x86 Under the configuration of armeabi The directory so Libraries can also be loaded and used normally .
in the light of 64 position ABI
If App Developers intend to support 64 position , that 64 Bit so Put it all , Otherwise, you can choose not to compile separately 64 Bit so, All use 32 Bit so,64 Bit models support... By default 32 position so Loading . such as Apk Use third party's so Only 32 position ABI Of so, Consider removing Apk in lib In the catalog 64 position ABI subdirectories , Guarantee Apk Normal use after installation .
Current general practice
because mips The market share is very low ,x86 It's compatible again armeabi, So just support arm The architecture can , and arm in arm64-v8a Of cpu The architecture is also downward compatible armeabi-v7a And armeabi,arm-v7a The architecture is also compatible armeabi . So it seems that you only need to use armeabi It can cover almost all models on the market , But only using armeabi There are more than performance problems , In some old equipment, there is no guarantee crash.
At present, the recommended practice is to only support armeabi and armeabi-v7a, Ensure that .so The number of documents is consistent , This can ensure compatibility and minimize apk Volume . For only armeabi Third party of version .so, Make a copy of the original to armeabi-v7a Folder .
Other
Native Libs Monitor This application can help us understand what is installed on the mobile phone APK What's used .so file , as well as .so Which function libraries or frameworks do the files come from .
边栏推荐
- Notes on the ninth day
- PHP获取当前时间戳三位毫秒 - 毫秒时间戳
- 高性能JVM的参数
- Dynamic planning daily practice (1)
- GLIB-CRITICAL g_file_test:assertion ‘filename != null‘ failed
- 反常积分的审敛
- [play with FPGA in simple terms to learn 10 ----- simple testbench design]
- 基于BIM+3DGIS的智慧城市基础设施管理
- High school Chinese teaching material examination outline
- 【STM32】串口通信基础知识
猜你喜欢

决策树详解

Day 12 notes

Notes on the seventh day
![[daily training] 814. Binary tree pruning](/img/c1/d71e6190a1855a392689b55503f75e.png)
[daily training] 814. Binary tree pruning

php连接sql server

Matplotlib- implement common probability distributions

Don't be silly to distinguish these kinds of storage volumes of kubernetes

浅谈Anroid设备的CPU类型以及so文件的放置目录

Remote editing and debugging with vscode

Backtracking method to solve the eight queens problem
随机推荐
"100 Android interview questions" I brushed angrily for Dachang
The principle of Google interview questions is to analyze 12 table tennis balls, one of which is defective. Weigh it with a balance for 3 times to find it
在虚拟环境下使用pip时默认使用系统环境的pip该怎么办
Why does the GOM engine version automatically drop the line or flash back?
ES6——周考题
Convergence of abnormal integral
Remote editing and debugging with vscode
Jenkins continuous integration error stderr: fatal: unsafe repository ('/home/water/water' is owned by someone else)
Shell operator, $((expression)) "or" $[expression], expr method, condition judgment, test condition, [condition], comparison between two integers, judgment according to file permission, judgment accor
深入解读 EVM 的生态帝国
【PART 2】OAK-D+TurtleBot3机器人项目全解析
[noi simulation race] I don't know which CF paper title it is (probability expectation, martingale's stop time theorem)
Shell运算符、$((运算式))” 或 “$[运算式]、expr方法、条件判断、test condition、[ condition ]、两个整数之间比较、按照文件权限进行判断、按照文件类型进行判断
机器学习,吴恩达逻辑回归
2022-07-22 回顾链表操作以及部分问题
Charles' bag grabbing tool test practice
微信小程序--动态设置导航栏颜色
概率沉思錄:2.The quantitative rules
PHP gets the current timestamp three bit MS MS timestamp
Point target simulation of SAR imaging (I) -- mathematical model