There are some questions like this one but none of the solutions provided does the trick. Build outputs the error from the title when building the app with two modules in it. One of the modules has the native code file.
有一些类似的问题,但是没有一个解决方案可以解决这个问题。Build在构建包含两个模块的应用程序时,输出标题中的错误。其中一个模块有本机代码文件。
I checked a lot of threads, all of them suggesting inclusion of the -llog. Similar thread here.
我检查了很多线程,所有线程都建议包含-llog。类似的线程。
my Android.mk:
我的Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := com_couchbase_touchdb_TDCollateJSON
LOCAL_SRC_FILES := com_couchbase_touchdb_TDCollateJSON.cpp
LOCAL_LDLIBS := -landroid -llog -ldl -L$(LOCAL_PATH)
include $(BUILD_SHARED_LIBRARY)
I also have the header <android/log.h>
included into the .cpp file, but I still get the same error.
我还有标题
1 个解决方案
#1
1
Most likely it is not __android_log_print
but something else that looks similar in your font, for example, __andriod_log_prlnt
(2 typos). In a C++ project there's name mangling and probably one of the files (it may be even an .h file) misses the header (that is, the order of #includes may be important). IIRC the order of -L
/-l
switches also is important, but probably it is not the case here.
很可能不是__android_log_print,而是其他类似的字体,例如__andriod_log_prlnt(2个拼写错误)。在c++项目中,有名称管理,可能有一个文件(甚至可能是.h文件)没有标头(也就是说,#include的顺序可能很重要)。IIRC -L/ -L开关的顺序也很重要,但这里可能不是这样。
I would start with the hello-jni sample in the NDK and add logging to it; then, I would gradually add the application code. If everything worked after that, the next step would be to move the jni/
folder into your application project, otherwise you'd know what step you did before it broke.
我将从NDK中的hello-jni示例开始,并向其添加日志记录;然后,我将逐渐添加应用程序代码。如果在那之后一切正常,下一步将是将jni/文件夹移到应用程序项目中,否则您将知道在它崩溃之前执行了什么步骤。
Just in case:
以防:
#include <android/log.h>
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG , "~~~~~~", __VA_ARGS__)
#define DLOG(...) __android_log_print(ANDROID_LOG_DEBUG , "~~~~~~", __VA_ARGS__)
#1
1
Most likely it is not __android_log_print
but something else that looks similar in your font, for example, __andriod_log_prlnt
(2 typos). In a C++ project there's name mangling and probably one of the files (it may be even an .h file) misses the header (that is, the order of #includes may be important). IIRC the order of -L
/-l
switches also is important, but probably it is not the case here.
很可能不是__android_log_print,而是其他类似的字体,例如__andriod_log_prlnt(2个拼写错误)。在c++项目中,有名称管理,可能有一个文件(甚至可能是.h文件)没有标头(也就是说,#include的顺序可能很重要)。IIRC -L/ -L开关的顺序也很重要,但这里可能不是这样。
I would start with the hello-jni sample in the NDK and add logging to it; then, I would gradually add the application code. If everything worked after that, the next step would be to move the jni/
folder into your application project, otherwise you'd know what step you did before it broke.
我将从NDK中的hello-jni示例开始,并向其添加日志记录;然后,我将逐渐添加应用程序代码。如果在那之后一切正常,下一步将是将jni/文件夹移到应用程序项目中,否则您将知道在它崩溃之前执行了什么步骤。
Just in case:
以防:
#include <android/log.h>
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG , "~~~~~~", __VA_ARGS__)
#define DLOG(...) __android_log_print(ANDROID_LOG_DEBUG , "~~~~~~", __VA_ARGS__)