Below is a snippet of code that you should include in your own code.
#include <android/log.h> __android_log_write(ANDROID_LOG_ERROR, "Tag", "Error msg");//Or ANDROID_LOG_INFO, ...
To use the above API, we need to link the appropriate library.
We can link the shared library in Android in three ways. In the below 3 cases, the specified lines should be added to Android.mk
So, here are three ways.
1. LOCAL_LDLIBS way LOCAL_LDLIBS := -llog
For some reason, if 1 doesn't work (it didn't work for me), you can try less than two ways
2. LOCAL_LDFLAGS way LOCAL_LDFLAGS := -llog 3. LOCAL_SHARED_LIBRARIES way LOCAL_SHARED_LIBRARIES += liblog
mk .. Mar 31 '14 at 9:21 2014-03-31 09:21
source share