Issue
i have a problem,
Below is the Android.mk
LOCAL_PATH := $(call my-dir)
INITIAL_PATH := $(LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpegbuilt
LOCAL_SRC_FILES := libffmpeg.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/
include $(PREBUILT_SHARED_LIBRARY)
LOCAL_PATH := $(INITIAL_PATH)
LOCAL_MODULE := main_module
LOCAL_ARM_MODE := arm # remove this if you want thumb mode
LOCAL_SRC_FILES := main.c
LOCAL_LDLIBS := -llog
LOCAL_SHARED_LIBRARIES := ffmpegbuilt
include $(BUILD_SHARED_LIBRARY)
It creates the two shared_libraries as expected. i see those two libraries inside libs/armeabi
folder
When i run the application, Unsatisfied Linker error occurs as
01-06 20:21:38.281: E/AndroidRuntime(435): FATAL EXCEPTION: main
01-06 20:21:38.281: E/AndroidRuntime(435): java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1962]: 32 could not load needed library 'libffmpeg.so' for 'libmain_module.so' (load_library[1104]: Library 'libffmpeg.so' not found)
01-06 20:21:38.281: E/AndroidRuntime(435): at java.lang.Runtime.loadLibrary(Runtime.java:434)
01-06 20:21:38.281: E/AndroidRuntime(435): at java.lang.System.loadLibrary(System.java:554)
What could be the problem, also though i defined LOCAL_MODULE := ffmpegbuilt
, why the prebuilt library's module name is not changing?
Solution
Let's start with the second question. No, the name of LOCAL_MODULE
for prebuilt libraries does not change the name of the file. This is how it was designed. Yes, this name has much more significant effect on built static and shared libraries. But rebuilt ones don't follow the same pattern.
Now to your first question. Android does not look for dynamic dependencies in the local app's lib directory. There are some technical reasons, and even some workarounds. But normally, we simply loadLibrary the local shared libraries in Java, keeping the correct order, so that external dependencies be resolved at every step.
In your case, this discussion resolves into
System.loadLibrary("ffmpeg");
System.loadLibrary("main_module");
Answered By - Alex Cohn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.