android-ndk Adding static libraries to the android.mk
I have three static libraries from a framework that I want to use in my proje开发者_StackOverflow中文版ct. These libraries are called libtinySAK_armv7-a.a, libtinyNET_armv7-a.a and libtinyHTTP_armv7-a.a
. I have placed them in the same folder as the Android.mk
andApplication.mk
.
My native code is dependent on them so I want to include them in my shared library.
From what I've read on stackoverflow and google'd I believe the android.mk is supposed to look something like this:
# TINYSAK
include $(CLEAR_VARS)
LOCAL_MODULE := tinySAK
LOCAL_SRC_FILES := libtinySAK_armv7-a.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../doubango/tinySAK/src/
include $(PREBUILT_STATIC_LIBRARY)
# TINYNET
include $(CLEAR_VARS)
LOCAL_MODULE := tinyNET
LOCAL_SRC_FILES := libtinyNET_armv7-a.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../doubango/tinyNET/src/
include $(PREBUILT_STATIC_LIBRARY)
# TINYHTTP
include $(CLEAR_VARS)
LOCAL_MODULE := tinyHTTP
LOCAL_SRC_FILES := libtinyHTTP_armv7-a.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../doubango/tinyHTTP/include/
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libtest
LOCAL_SRC_FILES := \
../../test/stack.cpp \
../../test/main.cpp
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../test/include/ \
$(LOCAL_PATH)/../../../doubango/tinyHTTP/include/ \
$(LOCAL_PATH)/../../../doubango/tinySAK/src/ \
$(LOCAL_PATH)/../../../doubango/tinyNET/src/
LOCAL_STATIC_LIBRARIES := \
tinySAK \
tinyNET \
tinyHTTP
include $(BUILD_SHARED_LIBRARY)
My Application.mk:
APP_STL := stlport_static
APP_ABI := armeabi-v7a
The error I get upon compilation("ndk-build" from project dir) is
jni/Android.mk:tinySAK: LOCAL_SRC_FILES points to a missing file
And I suppose the other 2 libraries also fail. Why cannot it find them? Besides that, is there any other errors I've made in the makefile?
Thanks
Nevermind, I solved it.
I declared the "LOCAL_PATH" in the beginning of the make-file only. Otherwise it would look for the libs in the ndk-folders.
Try LOCAL_LDLIBS
instead of LOCAL_SRC_FILES
.
精彩评论