Issue
Pre-requisites : I am using Android Studio 2.1.2
I have downloaded source of jsoncpp from following link
https://github.com/open-source-parsers/jsoncpp
I have already checked following SO thread , not getting proper solutions :
Using JsonCpp on X-Cross platform library
My common Android.mk is as follows:
LOCAL_PATH := $(call my-dir)
#JsonCpp lib
include $(CLEAR_VARS)
LOCAL_MODULE := jsoncpplib
include $(LOCAL_PATH)/jsnlib/Android.mk
LOCAL_STATIC_LIBRARIES := jsnlib
LOCAL_LDLIBS += -llog -ldl
include $(BUILD_SHARED_LIBRARY)
With code for building some other libraries too , which is working fine.
My jsoncpp's Android.mk is as follows
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/jsnlib/include/json/*.h
FILE_LIST += $(wildcard $(LOCAL_PATH)/jsnlib/src/lib_json/*.cpp)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_MODULE := jsnlib
LOCAL_MODULE_FILENAME:= libjsnlib
include $(BUILD_STATIC_LIBRARY)
When I do ndk-build always getting following error
Android NDK: jni/jsnlib/Android.mk:jsnlib: LOCAL_MODULE_FILENAME should not include file extensions
Android NDK: jni/jsnlib/Android.mk:jsnlib: LOCAL_MODULE_FILENAME must not contain a file extension
Solution
What happens here is that while you're in the middle of defining your jsoncpplib
module you include another makefile, which contains its own module definition:
include $(CLEAR_VARS)
LOCAL_MODULE := jsoncpplib
include $(LOCAL_PATH)/jsnlib/Android.mk
LOCAL_STATIC_LIBRARIES := jsnlib
LOCAL_LDLIBS += -llog -ldl
include $(BUILD_SHARED_LIBRARY)
You should move the inclusion of the other makefile to above the where you're doing CLEAR_VARS
:
include $(LOCAL_PATH)/jsnlib/Android.mk
include $(CLEAR_VARS)
LOCAL_MODULE := jsoncpplib
LOCAL_STATIC_LIBRARIES := jsnlib
LOCAL_LDLIBS += -llog -ldl
include $(BUILD_SHARED_LIBRARY)
Also, LOCAL_MODULE_FILENAME:= libjsnlib
seems redundant, since LOCAL_MODULE := jsnlib
should result in the same library name.
Answered By - Michael
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.