[Android-development] Service crashes on stop

Bernhard B schluchti at gmail.com
Tue May 9 14:48:02 CEST 2017


Hi,
There was a bug that prevented the C++ service from being stopped when the
Android service was destroyed (see
https://bugreports.qt.io/browse/QTBUG-58471).
As I am still using Qt 5.7.1 (commercial) I want to fix that also for my Qt
5.7.1 version. I looked at the diff from Bogdan and implemented something
similar. In
onDestroy() of my custom service I am calling a JNI function which does a
QCoreApplication::quit().

However my service doesn't cleanly shut down but stops with a crash:


05-05 19:09:32.014 10315 10330 E AndroidRuntime <geo:0,0?q=014 10315 10330
E AndroidRuntime>: java.lang.NullPointerException: Attempt to invoke
virtual method 'android.content.Context
android.app.Activity.getApplicationContext()' on a null object reference
05-05 19:09:32.014 10315 10330 E AndroidRuntime <geo:0,0?q=014 10315 10330
E AndroidRuntime>: at
org.qtproject.qt5.android.bearer.QtNetworkReceiver.getConnectivityManager(QtNetworkReceiver.java:91)

Does anyone know why this is happening? Is this a general bug (that's also
present on Qt 5.9) or something that's related to Qt 5.7.1?

Thanks,
Bernhard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20170509/f5eb0ad4/attachment.html>


More information about the Android-development mailing list