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