本文介绍了从 Android JNI 程序调用的 Log API 是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过将日志消息插入 logcat 来调试 JNI C 应用程序.执行此操作的 C API 是什么?
I would like to debug a JNI C application by inserting log messages to logcat. What is the C API that does this?
推荐答案
像这样:
#include <android/log.h>
__android_log_write(ANDROID_LOG_ERROR, "Tag", "Error here");//Or ANDROID_LOG_INFO, ...
像这样将它添加到你的makefile中:
Add it to your makefile like this:
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
这篇关于从 Android JNI 程序调用的 Log API 是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!