Add shared lib.so to android project

Michael 01/22/2011. 1 answers, 2.556 views
android android shared-libraries android-ndk android-ndk

I have an Android project using some native functions. Native functions are using some functions from external shared library "external_lib.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)

1 Answers


Zennichimaro 12/27/2011.

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)

Related questions

Hot questions

Language

Popular Tags