Simple use of Logcat in Android source code debugging

Source: Internet
Author: User

Recently has been working with the Android source code, the beginning is only in Ubuntu under the random programming, and then to start to modify the source, and then compile Android. The Android system is really complicated, especially for my rookie! Changed a few lines of source code, compiled and then burned to the development Board up, found that the system is a bit abnormal. Obviously just add three lines to write the code of the file Ah! It's completely confusing, and I don't know how to debug it. Later only know logcat this thing, tried, easy to use! The simple use of Logcat is recorded here, it is convenient for you to share:)

I am using Logcat in C + + code, LOGCAT can also be used in Java and MK files, if this is the case, please search separately.

1. Add the tag tag before the top include of the code:
#define LOG_TAG "Yourlogtagname"

2. Introduce the Log library:

#include <utils/Log.h>

3. Add the LOG statement:

Alogi ("This is your log content!");

Viewing the log is simple, just enter it directly in the ADB command window:

Logcat-s "yourlogtagname:*"

The "*" number indicates that the log information at all levels can be changed to I V D W E F S, meaning the following:

V:verbose

D:debug

I:info

W:warn

E:error

F:fatal

S:silent


Simple use of Logcat in Android source code debugging

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.