简体   繁体   English

armeabi 和 armeabi-v7a 文件夹

[英]armeabi and armeabi-v7a folder

I'm working on an Android project and I am using the NDK to call native methods.我正在开发一个 Android 项目,我正在使用 NDK 调用本机方法。 I have two libraries (.so files) and one is located in the libs/armeabi folder and the other one is located in the libs/armeabi-v7a lib folder.我有两个库(.so 文件),一个位于libs/armeabi文件夹中,另一个位于libs/armeabi-v7a lib 文件夹中。

If I try to run the application then it won't load the library in the /libs/armeabi folder.如果我尝试运行该应用程序,那么它将不会在/libs/armeabi文件夹中加载库。 If I move the library file to the libs/armeabi-v7a folder, then it loads the library but after 5 to 10 minutes it crashes and gives a segmentation fault error.如果我将库文件移动到libs/armeabi-v7a文件夹,则它会加载库,但 5 到 10 分钟后它会崩溃并给出分段错误错误。

I was wondering if the location of the library (different folder) might cause this problem.我想知道库的位置(不同的文件夹)是否会导致这个问题。

When installing an application, the package manager service will scan the.apk and look for any shared library of the form:安装应用程序时,package 管理器服务将扫描.apk 并查找以下形式的任何共享库:

     lib/<primary-abi>/lib<name>.so

If one is found, then it is copied under $APPDIR/lib/lib.so, where $APPDIR corresponds to the application's specific data directory.如果找到,则将其复制到 $APPDIR/lib/lib.so 下,其中 $APPDIR 对应于应用程序的特定数据目录。

If none is found, and a secondary ABI is defined, the service will then scan for shared libraries of the form:如果没有找到,并且定义了辅助 ABI,则该服务将扫描以下形式的共享库:

    lib/<secondary-abi>/lib<name>.so

If anything is found, then it is copied under $APPDIR/lib/lib.so.如果找到任何内容,则将其复制到 $APPDIR/lib/lib.so 下。

For the primary/secondary abi,对于主要/次要 abi,

The Android system knows at runtime which ABI(s) it supports. Android 系统在运行时知道它支持哪些 ABI。 More precisely, up to two build-specific system properties are used to indicate:更准确地说,最多使用两个特定于构建的系统属性来指示:

  • the 'primary' ABI for the device, corresponding to the machine code used in the system image itself.设备的“主要”ABI,对应于系统映像本身中使用的机器代码。

  • an optional 'secondary' ABI, corresponding to another ABI that is also supported by the system image.一个可选的“辅助”ABI,对应于系统映像也支持的另一个 ABI。

For example, a typical ARMv5TE-based device would only define the primary ABI as 'armeabi' and not define a secondary one.例如,典型的基于 ARMv5TE 的设备只会将主要 ABI 定义为“armeabi”,而不会定义次要 ABI。

On the other hand, a typical ARMv7-based device would define the primary ABI to 'armeabi-v7a' and the secondary one to 'armeabi' since it can run application native binaries generated for both of them.另一方面,典型的基于 ARMv7 的设备会将主要 ABI 定义为“armeabi-v7a”,将次要 ABI 定义为“armeabi”,因为它可以运行为两者生成的应用程序本机二进制文件。

This mechanism ensures that the best machine code for the target device is automatically extracted from the package at installation time.此机制可确保在安装时自动从 package 中提取目标设备的最佳机器代码。

The library loader will try to look for libraries that most closely match the architecture that you're running on.库加载器将尝试寻找与您正在运行的架构最匹配的库。 In general, you should compile one version of the library for each of the abis that you're planning to support (armeabi, armeabi-v7a, x86, mips) so that the compiler can optimize correctly.通常,您应该为您计划支持的每个 abis(armeabi、armeabi-v7a、x86、mips)编译一个版本的库,以便编译器可以正确优化。

The directory structure is how Android determines which lib to load, so it's critical you don't change it.目录结构是 Android 确定加载哪个库的方式,因此不要更改它至关重要。

I'm new to this myself, but going the same path... as far as I know, one may only have a single shared library;我自己是新手,但走的是同一条路……据我所知,一个人可能只有一个共享库; to use several libraries, make them static and link them together to a single shared one.要使用多个库,请将它们设为 static 并将它们链接到一个共享库。 Of course, this assumes you're building the libraries yourself;-)当然,这假设您正在自己构建库;-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android NDK-armeabi vs armeabi-v7a文件夹 - Android NDK - armeabi vs armeabi-v7a folder armeabi和armeabi-v7a之间的区别 - Difference between armeabi and armeabi-v7a Android L(5.0)不会在eclipse中的“ armeabi”或“ armeabi-v7a”文件夹(UnsatisfiedLinkError)中搜索本机库 - Android L (5.0) does not search native libraries in “armeabi” or “armeabi-v7a” folder (UnsatisfiedLinkError) in eclipse 用armeabi-v7a-hard替换armeabi-v7a是否安全? - is it safe to replace armeabi-v7a with armeabi-v7a-hard? armeabi,armeabi-v7a,x86 SQLCipher Android: - armeabi, armeabi-v7a, x86 SQLCipher Android: 以编程方式检查是否将使用armeabi,armeabi-v7a等lib? - Programmatically check whether armeabi, armeabi-v7a etc lib will be used? 为什么armeabi-v7a与另一个模块的armeabi冲突? - Why armeabi-v7a conflicts with armeabi of another module? 在armeabi-v7a设备上运行仅使用armeabi构建的应用程序? - Will an app built with only armeabi run on armeabi-v7a devices? 为armeabi编译的文件在armeabi-v7a上是否存在一些问题 - Do files compiled for armeabi have some problems with armeabi-v7a 为什么使用 armeabi-v7a 代码而不是 armeabi 代码? - Why use armeabi-v7a code over armeabi code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM