[Android-development] QNetworkAccessManager crashes by JNI-call (native Android) with Fatal signal 6 (SIGABRT)

Maik Ziemert mail at moozoom.de
Fri Jun 10 15:53:50 CEST 2016


I have a big problem with my Qt library - integrated in a native Android App over JNI.


I wrote a static qt library. In this library I instantiate a QNetworkAccessManager for using a network communication:


@QT CODE

void SimpleQtLibrary::createNetworkManager()
{

	QNetworkAccessManager *manager = new QNetworkAccessManager(this);
	
	<CRASH>
	
	...
	
	return;
}

@QT CODE END


I know, this async manager needs a own thread for internal signals. 


In my android project I will integrate this qt static library over jni:


@JNI CODE

#include <string.h>
#include <jni.h>
#include <android/log.h>

#include <qtlibrary.h>

static QtLibrary qtLib;

extern "C" {
	JNIEXPORT void JNICALL Java_com_company_qtlibrary_Interface_test(JNIEnv * env, jobject obj);
};

JNIEXPORT void JNICALL Java_com_company_qtlibrary_Interface_test(JNIEnv * env, jobject obj)
{
	qtLib.test();

	return;
}

@JNI CODE END


If I let running my android app, while the qt call over JNI, the app crashes:

Fatal signal 6 (SIGABRT) at 0x000072f1 (code=-6), thread 29425


How can I solve this problem? The QCoreApplication event loop works on the main thread (in Android), e.g. I can create a QTimer with a tick() every second.


Please help me in this case. I dont know what I can do to find a goof solution.


Thank you in advanced!




More information about the Android-development mailing list