1, modify the ANDROID.MK
If the resulting library file is a ". So file", add the following in Android.mk:
local_ldlibs:=-l$ (sysroot)/usr/lib-llog
If the generated library file is ". A file", add the following in Android.mk:
Local_ldlibs:=-llog
2 referencing a log header file in a. C or. cpp file
Add the following content:
// introduction of log header file #include // log Tag #define tag "hello_load"// define info #define LOGI (...) __android_log_ Print (android_log_info,tag,__va_args__)// define debug information #define LOGD (...) __android_ Log_print (Android_log_debug, TAG, __va_args__)// define error information #define LOGE (...) __android_ Log_print (android_log_error,tag,__va_args__)
Android_log_info: is the log level;
Tag: is the label to be filtered and can be filtered in the Logcat view.
__va_args__: is the actual log content.
After completing the 2 steps above, we can add Logi, LOGD, loge to print the information in the. c/cpp file!
JNI output Log information