任何简单或容易的方法来调试的Android NDK code? [英] Any simple or easy way to debug Android NDK code?
问题描述
我在寻找一种方式来轻松地使用Eclipse一个Android NDK应用程序调试C code。我读过的方式来调试应用程序,用gdb或类似的东西,但我想要的是一种将邮件推送到Eclipse的某种方式。
I'm looking for a way to easily debug C code in an Android NDK application using Eclipse. I've read ways to debug the app using gdb or something similar but what I want is a way to push messages to Eclipse somehow.
我正在寻找一个解决方案,它简单,只要用C语言打印功能,并看到它在DDMS登录或类似的话。有没有人有任何经验,这样做?
I'm looking for a solution that's as simple as using a print function in C and seeing it in the DDMS Log or anything similar. Does anyone have any experience doing this?
推荐答案
您可以使用Android日志工具:
You can use the Android logging facilities:
#include <android/log.h>
#define APPNAME "MyApp"
__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "The value of 1 + 1 is %d", 1+1);
请确保您还链接对日志库,在你的Android.mk文件:
Make sure you also link against the logging library, in your Android.mk file:
LOCAL_LDLIBS := -llog
这篇关于任何简单或容易的方法来调试的Android NDK code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!