I have built FFmpeg for Android and want to use it in an application like so:
System.loadLibrary("avutil");
System.loadLibrary("swscale");
System.loadLibrary("avcodec");
System.loadLibrary("avformat");
The build output are lib*.so
, lib*.so.MAJOR
and lib*.so.MAJOR.MINOR.OTHER
files. Inside the shared objects are references like lib*.so.MAJOR
, for example libswscale.so.2
requires libavutil.so.52
.
Now if I put the *.so
files in the project's libs
folder (more exactly libs/armeabi-v7a
), I of course get
01-25 12:06:40.270: E/AndroidRuntime(2905): java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1936]: 107 could not load needed library 'libavutil.so.52' for 'libswscale.so' (load_library[1091]: Library 'libavutil.so.52' not found)
However if instead I put the *.so.MAJOR
files in the libs
folder to solve the linking exception, I get the same error when running the app from Eclipse. And I noticed the files do not even get exported if I create an APK! So how do I tell Eclipse to package the *.so.MAJOR
files as libraries? Or alternatively, how do I compile the shared objects in a way that they reference each other by *.so
instead of *.so.MAJOR
?
EDIT: It seems there's no way to package *.so.XYZ
files automatically.