Solved The android application made by Qt 5.7 has crashed down on only Lollipop (API level 21).
-
I’m new at Qt but I’m a professional developer for android.
I’m testing the latest Qt version 5.7 for developing android apps.
I had created a new project with default options in Qt Creator and just built the project without adding any code.
After building, I ran the application on my desktop and it worked well on my desktop.
I changed the build option to “Android for armeabi-v7a (GCC 4.9, Qt 5.7.0)” in order to build android app binary.
After building the android binary, Qt Creator pushed the binary into my android device and let it run.
It worked as well.
However, when exiting the application by pushing “back” button on my android device, the application was always crashed down with a message “Unfortunately, xxxx has stopped.” and the Application Output window of Qt Creator showed me a message below as well.F/libc (19161): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 19395 (QtThread)
I didn’t understand why the application had been crashed down.
So, I investigated the problem on a lot of android device and I realized that the error occurred on only Lollipop android (Android API level 21).
The application worked well on other android such as Jellybean and Kitkat other than Lollipop.Any help on this issue would be great for me.
Thanks,
Doug -
There may be just some bug in Lollipop -- but I think Marshmallow too has had some problems in exiting the application using the back button. That's why my app tries to make the handling managed, by capturing the back button and "manually" calling some cleanup code and then the application object's quit():
bool MainWindow::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::KeyPress) { QKeyEvent* key = static_cast<QKeyEvent*>(event); if (key->key() == Qt::Key_Back) { MyApp->quit(); return true; } } return QObject::eventFilter(obj, event); }
-
I greatly appreciate your help.
I had tried to add your code in my app and ran the app after building.
However, the app was crashed down this time as well when exiting the app.
The error was the same as before.
I investigated this error further.By calling MyApp->quit(), The exec(); call of an application object in main() is returned well.
But, the app is crashed down after returning main() with a error “Unfortunately, xxxx has stopped.”.the Application Output window of Qt Creator showed me a message below as well.
F/libc (19161): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 19395 (QtThread)
I think this is not the problem from “back” key.
-
I found the root cause of this issue.
https://bugreports.qt.io/browse/QTBUG-52949
It was a bug of Lollipop 5.0.
The bug was first fixed in version 5.1.1_r1.