Android JNI utils/log. h cannot be found

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.