Android: add logging to QtCore JNI_OnLoad
Change-Id: I15609d14ac39f89bcba72df33d33a25ac23ad516 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
parent
40fdc4f44c
commit
5d61c0882c
@ -39,6 +39,10 @@
|
||||
|
||||
#include <jni.h>
|
||||
#include "qjnihelpers_p.h"
|
||||
#include <android/log.h>
|
||||
|
||||
static const char logTag[] = "QtCore";
|
||||
|
||||
|
||||
Q_CORE_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
@ -54,16 +58,24 @@ Q_CORE_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
void *venv;
|
||||
} _JNIEnv;
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, logTag, "Start");
|
||||
|
||||
_JNIEnv uenv;
|
||||
uenv.venv = Q_NULLPTR;
|
||||
|
||||
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_FATAL, logTag, "GetEnv failed");
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
JNIEnv *env = uenv.nenv;
|
||||
const jint ret = QT_PREPEND_NAMESPACE(QtAndroidPrivate::initJNI(vm, env));
|
||||
if (ret != 0)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_FATAL, logTag, "initJNI failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return JNI_VERSION_1_6;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user