Considering that your application works correctly on most devices and only occasionally gives you an error, we can safely assume that the library is correctly packed in the APK and that its size / memory size is also acceptable.
As such, I will go on a whim and suppose that the problem is related to the library assembly / compilation architecture. Most newer Android devices use the ARM7 processor. It is very likely that your library is compiled against the ARM7 architecture. Some older devices, especially those running Android 2.3, use an ARM6 processor (I have one such device that I use for testing - the LG GT540 running Android 2.3.3), which does not support transitions with the ARM7 architecture. I saw an error with an error similar to the one you indicated (load_segments: 68 could not display the segment from mylib.so) when I tried to run the application designed for ARM7 on my old ARM6 phone.
There are three ways around this problem:
Compile the library from both architectures and include two separate .so files in apk. Then, at runtime, determine the type of processor and load the correct one. Honestly, I do not know if this is possible.
Create two separate apk files - one for ARM6 and one for ARM7 - then use the filters in the manifest to specify the appropriate architecture. You can download both of them on Google Play for the same application - and the filters in the manifest will control which one is downloaded to any device.
Support the ARM7 architecture by specifying device requirements in the manifest. You will lose some customer audience, but you will have less work to maintain two versions of the application.
EDIT:. According to the NDK documentation, it can create several libraries for different architectures at a time. You can control which processors you want to configure by adding the following line to the Application.mk file:
APP_ABI := arch1 arch2 arch3 ...
eg,
APP_ABI := armeabi armeabi-v7a mips
Then the build process will create different versions of the native library. These versions should be placed in the latest apk in the directory
lib/<abi>/lib<name>.so
where is the name of the architecture. Then you load the library with
System.loadLibrary("<name>");
Alternatively, you can create separate apk files for each architecture, and then use the multi-apk functions in google play.
You can find all the architecture targeting information in the CPU-ARCH-ABIS.html in the docs NDK subdirectory.
Aleks G
source share