9

I am developing a native android application and using an open source library with .so file generated. Facing a strange behavior. For the first few times, the application worked perfectly well, with the library getting loaded. But now its not able to find the library and gives -

java.lang.UnsatisfiedLinkError: Couldn't load : findLibrary returned null

.Below are few observations: 1. when I extract the .apk file, the library (.so) is present under "lib/armeabi" folder. 2. but when I try to search the library (.so) into the devices extracted path of

/data/data//lib/ , its not present. Any suggestions as to why this strange behavior is happening and why the .so file is not getting extracted under /data/data/com.ibm.homeScreen/lib/ folder.

Thanks in advance!

JoshDM
  • 4,939
  • 7
  • 43
  • 72
user2072344
  • 465
  • 1
  • 5
  • 8

3 Answers3

0

If you use eclipse, check the buildpath settings: Right click on your project --> Properties --> JavaBuildPath --> Order and Export (is a Tab) and check there if the librar has been marked (checkbox) to export. There is also a possibility to set the native library path. You can find that option in the Library Tab --> Android Private Libraries --> EDIT Button on the right

This could also help

Community
  • 1
  • 1
sockeqwe
  • 15,574
  • 24
  • 88
  • 144
  • This doesn't seem likely to be relevant, especially as the poster says that the .so is present in the apk but not being unpacked on the device. – Chris Stratton Sep 26 '13 at 15:46
0

For eclipse project, simply put all your *.so files inside armeabi or armeabi-v7a folder, and put the folder inside /libs folder in your project. Compile, the *.so files will automatically be imported into /data/data//lib

For Android studio, the above approach didn't work for me. instead I have to place the armeabi and armeabi-v7a folders into /jniLibs instead of /libs. Note that I am using Gradle 0.10.+ though, not sure if it works on older Gradle.

enter image description here

Guster
  • 1,733
  • 1
  • 16
  • 18
0

You can find some further information about this problem here: Why do some Android phones cause our app to throw an java.lang.UnsatisfiedLinkError? https://code.google.com/p/android/issues/detail?id=59420

The stackoverflow link also contains some code with a workaround in the (currently) last answer.

Sebastian Dröge
  • 2,063
  • 11
  • 9