My app crashes on Android 10
devices with the following call stack:
backtrace:
#00 pc 000000000006f06c /apex/com.android.runtime/lib64/bionic/libc.so (abort+160)
#01 pc 00000000000500fc /system/lib64/libc++.so (abort_message+232)
#02 pc 0000000000050218 /system/lib64/libc++.so (demangling_terminate_handler()+44)
#03 pc 00000000000646c4 /system/lib64/libc++.so (std::__terminate(void (*)())+12)
#04 pc 000000000006466c /system/lib64/libc++.so (std::terminate()+52)
#05 pc 00000000000bb150 /system/lib64/libc++.so (std::__1::thread::~thread()+20)
#06 pc 00000000000d0f48 /apex/com.android.runtime/lib64/bionic/libc.so (__cxa_finalize+212)
#07 pc 00000000000cc930 /apex/com.android.runtime/lib64/bionic/libc.so (exit+24)
#08 pc 0000000000032f30 /data/app/com.domain.myapp-Rs_sm5VrLR1Jj8QW6oYByA==/lib/arm64/libplugins_platforms_qtforandroid_arm64-v8a.so
I have no idea when and why this happens, because I can't reproduce this on my devices and emulators, but this intensively happens at the user side and only on Android 10
(not on previous Android versions).
My QT
version is 5.14.2.
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java or Kotlin crashes if it throws an unhandled exception, represented by the Throwable class.
The easiest way to fix an app that keeps crashing on your Android smartphone is to simply force stop it and open it again. To do this, go to Settings -> Apps and select the app that keeps crashing. Tap on the app's name and then tap on 'Force stop'. Now try opening the app again and see if it works well.
We've just released an update for one of our games and it looks as if the crash is fixed. This is what we did: Android 10 and Android 9 show a different default behaviour when using the Android back button. On Android 10 the app closes but on the console output I see the app being stuck in a loop for about 5 seconds before it really quits. This does not happen on Android 9. This is the output I get on an Android 10 device when I hit the back button and the app closes:
....
05-04 18:26:21.315 26882 26908 I nkeycat.tendow:
I nkeycat.tendow: QarthPatchMonintor::CheckNotifyEvent
05-04 18:26:21.315 26882 26908 I nkeycat.tendow:
I nkeycat.tendow: QarthPatchMonintor::CheckNotifyEvent before read
05-04 18:26:21.315 26882 26908 I nkeycat.tendow:
I nkeycat.tendow: QarthPatchMonintor::CheckNotifyEvent after read, length = -1
05-04 18:26:21.315 26882 26908 I nkeycat.tendow:
I nkeycat.tendow: QarthPatchMonintor::CheckNotifyEvent
05-04 18:26:21.315 26882 26908 I
...
I am now catching the Android back button everywhere In QML and when the user really wants to quit the app, I call the following custom Java function to quit gracefully:
public String quitApp() { // Qt C++ call
try {
finishAffinity();
System.exit(0);
} catch (Exception exc) {
exc.printStackTrace();
logException(exc);
}
return "";
}
We have also implemented the what David K. Hess suggested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With