当前位置:网站首页>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 .
边栏推荐
- Smart canteen data analysis system
- High school Chinese teaching material examination outline
- 离屏渲染 &FBO
- Remote editing and debugging with vscode
- 【JS高级】正则入门基础—关于你想知道的正则表达式_01
- 回溯法解决 八皇后问题
- 【可視化調度軟件】上海道寧為SMB組織帶來NETRONIC下載、試用、教程
- China leads the United States in another emerging technology field and stands at the commanding height of scientific and technological innovation
- Special lecture 5 combinatorial mathematics learning experience (long-term update)
- 深入解读 EVM 的生态帝国
猜你喜欢

Backtracking method to solve the eight queens problem

接口测试-简单的接口自动化测试Demo

反常积分的审敛
![[jzof] path in matrix 12](/img/33/426386fc3dc3e32b6968d30034d66a.png)
[jzof] path in matrix 12

docker redis

kubernetes 的这几种存储卷,别再傻傻分不清了

Jupyter notebook add existing virtual environment

Debug No5 basic lighting

Introduction to radar part vii 1 radar and resolution

Successful joint commissioning of Vientiane Aoke and CoDeSys Technology
随机推荐
同花顺开户风险性大吗,安全吗?
浅谈Anroid设备的CPU类型以及so文件的放置目录
Interface test - simple interface automation test demo
PHP获取当前时间戳三位毫秒 - 毫秒时间戳
C language insert sort (direct insert sort)
Dynamic planning daily practice (1)
Deep understanding of the underlying framework of wechat applet (I)
云解决方案,为什么选择 AMD EPYC?
中国在又一个新兴科技领域领先美国,站在科技创新制高点
In depth interpretation of EVM's ecological Empire
docker mysql
Beifu PLC and C transmit structure type variables through ads communication
Power BI----综合应用
-XX:+UseCGroupMemoryLimitForHeap 无法创建虚拟机问题
Bit synchronization process of CAN controller
养老机构智能视频监控解决方案,用新技术助力养老院智慧监管
Kept dual machine hot standby
“算力猛兽”浪潮NF5468A5 GPU服务器开放试用免费申请
Learn to use canvas to build line chart, bar chart and pie chart
QNX修改系统时间