20

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?

frogatto
  • 27,475
  • 10
  • 76
  • 119
Victor S
  • 3,791
  • 15
  • 40
  • 53

3 Answers3

47

You can use the following code to get Log

  __android_log_print(ANDROID_LOG_ERROR, "TRACKERS", "%s", Str);

and add the following header file

#include <android/log.h>

Additional docs are here: https://developer.android.com/ndk/reference/group/logging

Usman Kurd
  • 8,335
  • 7
  • 56
  • 84
2

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.

Usman Kurd
  • 8,335
  • 7
  • 56
  • 84
BonderWu
  • 133
  • 10
0

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);".

Tarun Chawla
  • 453
  • 4
  • 14