Skip to content
Permalink
Browse files

readded logging capabilities of qtmain_android

  • Loading branch information
mbernasocchi committed Aug 15, 2011
1 parent 2ea6fd8 commit 9642ada741fb27f84614cce3c41455ce48fa4a53
Showing with 11 additions and 7 deletions.
  1. +4 −1 src/app/CMakeLists.txt
  2. +7 −6 src/app/qtmain_android.cpp
@@ -392,7 +392,6 @@ IF (POSTGRES_FOUND)
ENDIF (POSTGRES_FOUND)

#############
SET(QGIS_APP_LIB_NAME ${QGIS_APP_NAME}_app)
IF (ANDROID)
ADD_LIBRARY(${QGIS_APP_NAME} SHARED ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${INDEX_SRC} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS})
ELSE (ANDROID)
@@ -411,6 +410,10 @@ TARGET_LINK_LIBRARIES(${QGIS_APP_NAME}
qgis_analysis
)

IF (ANDROID)
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} log)
ENDIF (ANDROID)

IF( WIN32 )
ADD_DEFINITIONS(-DQWT_DLL)
ENDIF( WIN32 )
@@ -113,19 +113,19 @@ static int registerNativeMethods(JNIEnv* env, const char* className,
jclass clazz=env->FindClass(className);
if (clazz == NULL)
{
//__android_log_print(ANDROID_LOG_FATAL,"Qt", "Native registration unable to find class '%s'", className);
__android_log_print(ANDROID_LOG_FATAL,"Qt", "Native registration unable to find class '%s'", className);
return JNI_FALSE;
}
jmethodID constr = env->GetMethodID(clazz, "<init>", "()V");
if(!constr) {
//__android_log_print(ANDROID_LOG_FATAL,"Qt", "Native registration unable to find constructor for class '%s'", className);
__android_log_print(ANDROID_LOG_FATAL,"Qt", "Native registration unable to find constructor for class '%s'", className);
return JNI_FALSE;;
}
jobject obj = env->NewObject(clazz, constr);
objptr = env->NewGlobalRef(obj);
if (env->RegisterNatives(clazz, gMethods, numMethods) < 0)
{
//__android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed for '%s'", className);
__android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed for '%s'", className);
return JNI_FALSE;
}
return JNI_TRUE;
@@ -149,22 +149,23 @@ typedef union {

Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* /*reserved*/)
{
//__android_log_print(ANDROID_LOG_INFO,"Qt", "qt start");
__android_log_print(ANDROID_LOG_INFO,"Qt", "qt start");
UnionJNIEnvToVoid uenv;
uenv.venv = NULL;
m_javaVM = 0;

if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK)
{
//__android_log_print(ANDROID_LOG_FATAL,"Qt","GetEnv failed");
__android_log_print(ANDROID_LOG_FATAL,"Qt","GetEnv failed");
return -1;
}
m_env = uenv.nativeEnvironment;
if (!registerNatives(m_env))
{
//__android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed");
__android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed");
return -1;
}
m_javaVM = vm;
__android_log_print(ANDROID_LOG_INFO,"Qt", "JNI OK");
return JNI_VERSION_1_4;
}

0 comments on commit 9642ada

Please sign in to comment.
You can’t perform that action at this time.