2010102114272010.10.21 How to use "logcat" in JNI

The four instructions for using "logcat" in JNI:

   1. Include the header file "android/log.h" as follows:

           #include <android/log.h>

   2. Define the need functions as follows:

       I only the one.

           #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG  , "liblog",__VA_ARGS__) 

      Other functions is below:

           #define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, "liblog",__VA_ARGS__)

           #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, "liblog",__VA_ARGS__)

           #define LOGW(...) __android_log_print(ANDROID_LOG_WARN, "liblog",__VA_ARGS__)

           #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "liblog",__VA_ARGS__)

   3. You can use the LOGD function in the source code.

          LOGD("Debug Message is from JNI");

   4. Add some words in the file "Android.mk" 

          LOCAL_LDLIBS :=  -L$(SYSROOT)/usr/lib -llog

      P.S. I refer some information that tell me add the line under "LOCAL_PATH := $(call my-dir)". When I build the JNI code, the undefined reference always happened. So I move the line above the line "include $(BUILD_SHARED_LIBRARY)", then the error disappeared. I think that the reason is the path of the directory.

沒有上一則|日誌首頁|沒有下一則
回應
努力尋找屬於自己的方向,決定一件事,堅定意志去做,也許會遇到很多障礙,但是翻越障礙的自己會更勇敢的。
    沒有新回應!
累積 | 今日
loading......





Powered by Xuite
我的地圖
麗星郵輪石垣島四天三夜那霸克莉貓台東2009華閣生日研究所花蓮礁溪日記新竹阿里山壽豐初鹿牧場沖繩christine鹿野高台津芳中壢android西堤日出愛情阿德南斯宜蘭日月潭VS2008潤餅木石噹!我們同在一起Development Serverwasabi國際旅展我是心超人SDK苦悶生日天移除白色地中海剃毛旅行的意義HP CQ20Plurkpa結婚高雄高美濕地溫泉魚鯉魚潭more
mixpanel