Android log output is used from the android JNI code downloaded from the Internet,
If # include <utils/log. h> is used in the jni c file
Compile with ndk. The error message "error: utils/log. h: no such file or directory" is displayed in ndk-build clean & ndk-build.
If you only use the log function
1. modify the configuration of the android. mk file and add the following statement:
Local_ldlibs + =-L $ (sysroot)/usr/lib-llog
2. Replace the following statement in the. c file:
// # Include
<Utils/log. h> // close this row
# Include <alog. h> // Add some rows.
The contents of the 3 alog. h file are as follows:
#pragma once#include<android/log.h>#define LOG_TAG "debug log"#define LOGI(fmt, args...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, fmt, ##args)#define LOGD(fmt, args...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, fmt, ##args)#define LOGE(fmt, args...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, fmt, ##args)
4 ---- You can use log output information, which is the same as log. I at the Java layer.
Logi ("JNI Android log !!!! ")
Logd ("the string is: % s \ n", strmsg );
LogE (strerror (errno ))