armeabi and armeabi-v7a folder
Asked Answered
B

3

13

I'm working on an Android project and I am using the NDK to call native methods. 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.

If I try to run the application then it won't load the library in the /libs/armeabi folder. 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.

I was wondering if the location of the library (different folder) might cause this problem.

Bina answered 6/6, 2011 at 8:40 Comment(1)
hey.. did u solve it? i have a doubt. if i build ffmpeg for armv7-a arch. can i use it on armeabi devices? I'm new to it. i have build it for armv7-a cross compiled.Idealistic
C
-6

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. Of course, this assumes you're building the libraries yourself ;-)

Chili answered 22/9, 2011 at 17:7 Comment(1)
This is not correct. It is quite possible to have multiple shared libraries, though it introduces extra complexity that's easy to get wrong and have problems.Redroot
A
22

When installing an application, the package manager service will scan the .apk and look for any shared library of the form:

     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.

If none is found, and a secondary ABI is defined, the service will then scan for shared libraries of the form:

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

If anything is found, then it is copied under $APPDIR/lib/lib.so.

For the primary/secondary abi,

The Android system knows at runtime which ABI(s) it supports. 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.

  • an optional 'secondary' ABI, corresponding to another ABI that is also supported by the system image.

For example, a typical ARMv5TE-based device would only define the primary ABI as 'armeabi' and not define a secondary one.

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.

This mechanism ensures that the best machine code for the target device is automatically extracted from the package at installation time.

Aflcio answered 25/4, 2013 at 7:22 Comment(3)
Are armeabi libraries directly compatible with armeabi-v7a? I mean - will it work if you move your libraries from the folder armeabi to the folder armeabi-v7a? That's something that one would do if he uses libraries that are only available in armeabi, and at the same time he wants to use libraries that are only available in armeabi-v7a.Cristiano
Thanks, I know this one. I was wondering whether an armeabi library will be expected extra things if it's placed in the armeabi-v7a folder instead of the armeabi folder (on an armeabi-v7a device). I thought that in some cases it may crash, if the device considers it to be built for armeabi-v7a.Cristiano
@Cristiano I use armeabi/libxx.so in Android.mk file for armv7-a. It crashes.Niece
R
6

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.

The directory structure is how Android determines which lib to load, so it's critical you don't change it.

Redroot answered 27/7, 2012 at 22:37 Comment(0)
C
-6

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. Of course, this assumes you're building the libraries yourself ;-)

Chili answered 22/9, 2011 at 17:7 Comment(1)
This is not correct. It is quite possible to have multiple shared libraries, though it introduces extra complexity that's easy to get wrong and have problems.Redroot

© 2022 - 2024 — McMap. All rights reserved.