Any simple way to log in Android NDK code?

前端 未结 7 2394
無奈伤痛
無奈伤痛 2020-12-02 12:09

I\'m looking for a way to easily debug C code in an Android NDK application using Eclipse. I\'ve read ways to debug the app using gdb or something similar but what I want i

7条回答
  •  心在旅途
    2020-12-02 12:23

    You can use the Android logging facilities:

    #include 
    
    #define APPNAME "MyApp"
    
    __android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "The value of 1 + 1 is %d", 1+1);
    

    Make sure you also link against the logging library, in your Android.mk file:

      LOCAL_LDLIBS := -llog
    

提交回复
热议问题