Issue
I am compiling a 3rd party c library for android app as a shared library. I would like to add android logging to the source code of the c library so I can see what methods gets called, with what arguments. But I can not make it work. I tried the following:
Add -llog to Android.mk for the c library
LOCAL_CFLAGS := := ... -llog
Add header file to the source file abc.c where I want to log
#include < android/log.h>
add line
__android_log_print(ANDROID_LOG_DEBUG, "MyApp", "This is method X");
Error: __android_log_print is not recognized.
What should I do to make it work?
Solution
__android_log_print
takes variadic, printf
-like arguments after the 3rd one. Use
__android_log_write(ANDROID_LOG_DEBUG, "MyApp", "This is method X");
instead, for no-extra-arguments logging.
EDIT: -llog is a linker flag, not a compiler one. Remove
LOCAL_CFLAGS := := ... -llog
and instead write
LOCAL_LDLIBS := -llog
Answered By - Seva Alekseyev
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.