JNI Output Log Information

Source: Internet
Author: User

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

Related Article

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.