Any simple way to log in Android NDK code?

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);

Make sure you also link against the logging library, in your Android.mk file:

  LOCAL_LDLIBS := -llog

Leave a Comment