C / C ++ printfs输出 - 在哪里就出现在Android原生code? [英] C/C++ printfs - Where's it appears in a Android native code?
本文介绍了C / C ++ printfs输出 - 在哪里就出现在Android原生code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于这是pretty的难以调试原生的Android code,我要去printf的痕迹的做法。
Since It's pretty hard to debug native android code, I'm going to the "printf trace" approach.
所以,我的问题是,在本机code,哪来的标准的printf(东西)出现运行Android应用程序是什么时候?
So, my question is, in a native code, wheres the standards "printf("something")" appears when running a Android application?
推荐答案
登录到logcat中。
Log to logcat.
1)要调用本机code中的记录包括报头和呼叫_android_log_write(..)。
1) To invoke the logger in native code include the header and call _android_log_write(..).
#include <android/log.h>
__android_log_write(ANDROID_LOG_INFO, "tag here", "message here");
2)在你的Android.mk文件中包含这样的日志库。
2) In your Android.mk file include the log lib like this.
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
这篇关于C / C ++ printfs输出 - 在哪里就出现在Android原生code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文