Quick example of sending debug info to the log in Android JNI C++

#include <android/log.h>

#define  LOG_TAG    "DEBUG"
#define  LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)

// Implementation of the native method sayHello()
JNIEXPORT jstring JNICALL Java_com_ancientcoder_recog_MainActivity_sayHello(JNIEnv *env, jobject thisObj) {
    LOGD("Running C++");
}

 

 

Advertisements