Thursday 11 March 2021

Android Load a compiled native library at runtime from a storage folder (.so)

I am using FFmpeg in my application and as a result of its GNU Lesser General Public License, version 2.1 I need to provide a way for the user to load their version of FFmpeg during runtime inside the app. Here is an example of app "Bandlab" that does this.

enter image description here

I tried to load the custom libraries with

System.load(PATH_TO_LIBRARY);

but this crashes my app and the log is the following:

E/AndroidRuntime(22353): FATAL EXCEPTION: main E/AndroidRuntime(22353): Process: com.insync.loopad, PID: 22353 E/AndroidRuntime(22353): java.lang.UnsatisfiedLinkError: dlopen failed: library "/storage/emulated/0/Android/data/com.insync.myApp/files/FFmpeg/libavcodec.so" needed or dlopened by "/apex/com.android.runtime/lib64/libnativeloader.so" is not accessible for the namespace "classloader-namespace"

I read it here that I can not use this call to load a compiled native library at runtime. So I wonder how did this app achieved this? Can someone help me on this one?



from Android Load a compiled native library at runtime from a storage folder (.so)

No comments:

Post a Comment