什么是日志API从Android的JNI程序来调用? [英] What is the Log API to call from an Android JNI program?

查看:124
本文介绍了什么是日志API从Android的JNI程序来调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过插入日志消息的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 

这篇关于什么是日志API从Android的JNI程序来调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆