由于这是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