1

I'm having an issue where my APK is able to load a .so file contained in its /data/data/app/lib folder, but the linker is unable to find its dependencies also located in that folder. The error is:

D/dalvikvm( 5541): Trying to load lib /data/data/app/lib/liba.so 0x41978aa8
W/dalvikvm( 5541): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lapp;
...
E/AndroidRuntime( 5541): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]:  1679 could
 not load needed library 'libb.so' for 'liba.so' (load_library[1093]: Library 'libb.so' not found)

Interestingly there are other dependencies which are found because they are shipped with android in /system/lib, but I can't work out why it won't look in the /data/data/app/lib folder?

EDIT: This is different to the question this is marked as duplicating, as it regards operation of linking at runtime, and not how to import libraries into Eclipse IDE. The workaround of explicitly loading dependencies in order is mentioned in the questions here and here however

Community
  • 1
  • 1
chrisvarnz
  • 439
  • 7
  • 17

1 Answers1

3

As fadden points out above, the solution is to explicitly load the dependencies first, as in:

System.loadLibrary("b"); System.loadLibrary("a");

chrisvarnz
  • 439
  • 7
  • 17