Add shared lib.so to android project
I have an Android project using some native functions. Native functions are using some functions from external shared library "external_li开发者_高级运维b.so" I've added to Android.mk: "-lexternal_lib -L/path/to/external/lib" line and myjni.so have been linked successfully. But during runtime myjni.so loading error occurred. The size of myjni.so reflects that external_lib.so is not included. How to fix the problem?
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := myjni LOCAL_SRC_FILES := myjni.c LOCAL_LDLIBS := -ldl -llog -lz -lexternal_lib -L/path/to/external/lib
include $(BUILD_SHARED_LIBRARY)
is the .so a third party prebuilt shared library? if so, in your Android.mk, you need to have:
...
LOCAL_SHARED_LIBRARY := curl
...
LOCAL_LDLIBS += -L$(ANDROID_LIBCURL_LIB_PATH) -lcurl LOCAL_SHARED_LIBRARIES := curl
include $(BUILD_SHARED_LIBRARY)
精彩评论