Error:
It might happen that, when combining multiple native (JNI) libraries, your Android app will crash with an
UnsatisfiedLinkError.
Why does this happen?
Well long-story-short, your libraries differ from each other in terms of ABIs (target CPU architecture).
For a detailed explanation, please follow the link below (also attached in PDF format).
https://www.neotechsoftware.com/blog/native-libraries-part-i-common-pitfalls
How to fix it?
Let's say your project utilizes
libA (ARM, x86),
libB (ARM, ARMv7, x86) and
libC (ARM, x86, MIPS).
It's already obvious that such project will only work on ARM and x86 architectures.
So basically, you need to remove the unnecessary ABIs folders.
Step 1: Find out which libraries target unsupported architectures
- Open your APK with
7Zip (right-click, open with...), go to
lib and explore the sub-folders
- Find the lowest common denominator: in our example that's
ARM and
x86
- Close the APK file without making any changes
Step 2: Modify the libraries
- Go to your
B4A External Libs folder and make copies of
libB.jar and
libC.jar (in the same folder)
- Open the
libB and
libC copies with
7Zip
-
libB: go to libs,
delete the ARMv7 folder
-
libC: go to libs,
delete the MIPS folder
- Refresh the B4A libs and select the modified ones
Result:
All of your project's native libraries now target exactly the same architectures: ARM and x86!
The error should be gone (works for me)!
