Compiling libFLAC without creating versions

287 Views Asked by At

I'm trying to port libFLAC to android, and I'm running into the following problem.

I believe i've gotten the android toolchain properly configured, and I can compile a .so file.

However I get three .so files from the process:

libFLAC.so, libFLAC.so.8 libFLAC.so.8.3.0

If i bring libFLAC.so into my android build, i get a failure eventually with:

java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libFLAC.so.8" needed by "libLibFlacWrapper.so"; caused by library "libFLAC.so.8" not found
E/AndroidRuntime(26684): 

As I understand it this relates to versions of libraries being able to coexist, and is a pretty normal thing. The problem is that android does not support this naming convention, as evidenced:

https://code.google.com/p/android/issues/detail?id=64397

Essentially the package manager can't handle the extended naming conventions.

Bundling those files in the jniLibs dir, or some other location does not seem to solve the problem.

How would i get around this? is my compilation wrong? Or is there a way to rename these so they aren't version numbers?

1

There are 1 best solutions below

0
On BEST ANSWER

I managed to get around this thanks to:

https://github.com/showlabor/libloader

It's a little weird, but basically just make sure your versioned libraries (the .8, .8.3.0 in my case) are in a libs directory (or otherwise bundled in the jar) and you can load them using this method.