jsoncpp的ndk-build总是给出一个错误

时间:2016-09-01 14:40:39

标签: android-studio android-ndk jsoncpp

先决条件:我使用的是Android Studio 2.1.2

我已从以下链接

下载了jsoncpp的源代码

https://github.com/open-source-parsers/jsoncpp

我已经检查了以下SO线程,没有得到正确的解决方案:

LOCAL_MODULE_FILENAME should not include file extensions i get this error each time i run ndk-build in terminal

Using JsonCpp on X-Cross platform library

我常见的Android.mk如下:

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)

使用代码来构建其他一些库,这样可以正常工作。

我的jsoncpp的Android.mk如下

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)

当我执行ndk-build时总是会出现以下错误

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

1 个答案:

答案 0 :(得分:1)

这里发生的是,当您正在定义RewriteCond %{REQUEST_URI} m.* RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^m(.*)$ articles.php?$1 [T=application/x-httpd-php,L] 模块时,您需要包含另一个包含其自己的模块定义的makefile:

jsoncpplib

您应该将其他makefile的包含移到您正在执行的位置include $(CLEAR_VARS) LOCAL_MODULE := jsoncpplib include $(LOCAL_PATH)/jsnlib/Android.mk LOCAL_STATIC_LIBRARIES := jsnlib LOCAL_LDLIBS += -llog -ldl include $(BUILD_SHARED_LIBRARY) 之上:

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) 似乎是多余的,因为LOCAL_MODULE_FILENAME:= libjsnlib应该会产生相同的库名称。