Android: UnsatisfiedLinkError due to folder structure in "lib"?

My application now uses 2 native libraries, allows you to call them LibA and LibB. Previously, my application used only 1 native library (LibA) without problems.

  • LibA only compiles for armeabi
  • LibB compiled for armeabi, armeabi-v7a and x86.

which leads to this structure in apk when I am unzipped for verification:

  • appfolder / lib / armeabi / liba.so
  • appfolder / Library / armeabi / libb.so
  • appfolder / lib / armeabi-v7a / libb.so
  • appfolder / Library / x86 / libb.so

Loading LibB through System.LoadLibrary ("b") works fine.

However, loading LibA failed on Nexus 4 with UnsatisfiedLinkError.

When I delete the "armeabi-v7a" and "x86" folders from the LibB project, leaving only the armeabi folder, both of my own libraries work fine.

I assume that android is trying to download libA from the "armeabi-v7a" folder, because the folder exists, but liba.so was not found in it.

If my assumption is correct, how can I prevent it?

I am new to native libraries in android. Thanks in advance!

+4
source share

All Articles