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 i
No one has posted info about different log levels so far. The answer is an attempt to make the logging "picture" full.
#include
#define TAG "MY_TAG"
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
Usage:
char err[] = "wrong";
LOGE("Something went %s", err);
Link Android log library as below.
Android.mk:
LOCAL_LDLIBS := -llog
CMakeLists.txt:
find_library( log-lib log )
target_link_libraries( ${log-lib} )
Further reading: Logging