'How to print log in android c++ file?
I added
#define LOG_NDEBUG 0
#define LOG_TAG "StagefrightMediaScanner"
#include <utils/Log.h>
in the libstagefright/StagefrightMediaScanner.cpp
but can not print anything using LOGV and LOGE, does any other things can I need to do?
Solution 1:[1]
You can check frameworks/av/media/libstagefright/Android.mk, whether there is
LOCAL_SHARED_LIBRARIES += liblog
in it.
Then, under frameworks/av/media/libstagefright/
$ mm
$ adb push $OUT/system/lib/libstagefright.so /system/lib/
$ adb shell killall mediaserver
Then reboot your phone or am start a MEDIA_MOUNTED intent, MediaScanner will work, and the logs you just added(either ALOGE/ALOGV or LOGE/LOGV) should be shown.
Solution 2:[2]
No you have done right. Just check it whether you are using ALOGV() which is similar to printf(),if you want to print a integer with a log then you can write like this :" ALOGV("Integer is %d",integer);".
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Usman Kurd |
| Solution 2 | Tarun Chawla |
