Linking external libraries to Android native shared library

18 views
Skip to first unread message

purvi

unread,
Jan 5, 2010, 5:32:08 PM1/5/10
to android-platform
Hi,

I have a question. To include any external library whether a static
library (*.a) or shared library (*.so) and link to the current native
shared library I have to inlcude the below code in my Andriod.mk

include $(CLEAR_VARS)

LOCAL_PREBUILT_LIBS:= libexternal1.a

include $(BUILD_MULTI_PREBUILT)

include $(CLEAR_VARS)

LOCAL_MODULE:=mynativeexample

LOCAL_SRC_FILES:=myexample.c

LOCAL_STATIC_LIBRARIES:=libexternal1

include $(BUILD_SHARED_LIBRARY)

The library libexternal1.a is compiled and build outside android. and
resides in the directory same as the path of my Andriod.mk
The path is \android-ndk-1.6_r1\apps\MyApplication\project\jni\.

And I am getting an error : No rule to make target 'out/apps/
MyApplication//libexternal1.a' needed to make 'out/apps/MyApplication//
mynativeexample.so'
If I copy the libexternal1.a to 'out/apps/MyApplication//' it gives me
error
'out/apps/MyApplication//libexternal1.a' : file not recognized: File
format not recognized
As per few android-ndk threads I went thru it is improper to copy the
libexternal1.a to the out directory as the library should be
automatically created in the 'out' directory.
Something is missing in my Android.mk or something related to path of
my external static library.

The same error occurs when I use a shared library instead of static
library.

Can anyone please help me why is this happening and how to solve
this.?

Thanks.
Regards,
Purvi

Reply all
Reply to author
Forward
0 new messages