Important: Please read the Qt Code of Conduct -

How to handle exceptions on Android?

  • Hi,

    we're porting a desktop app to Android, using Qt 5.6.2 and we are making good progress but have run into a problem with Exceptions. In our desktop app we have overridden the QCoreApplication::notify method in a derived Application object to be able to catch and handle exceptions. So if I put a breakpoint anywhere into the code and then look at the call stack, I will always see that our notify method has been called and thus goes through try {} catch() where we can deal with exceptions.

    However, when I do the same on Android it seems that QApplication::notify is being called by the event dispatcher, not our implementation...

    My question is thus, what is the correct way of doing this on Android?

    Thanks for your help,


  • Just as an extra bit of information. When putting a breakpoint into the notify() method I can see that some events are indeed going through this method, however, it looks like events from the UI, e.g. when user clicks a button, bypass my notify method.

  • Did I say that it works fine in the x86 emulator but NOT when running on an actual ARM device?

    To be precise.. when I am on an x86 AVD and throw an exception in a slot connected to a button clicked() signal my implementation of QApplication::notify() gets called and it handles the exception gracefully. However, when doing the same on a Samsung Galaxy E ARM KitKat 4.4 the application aborts with SIGABRT.

  • I am now convinced that this is actually a bug in the ARM port and have now raised a bug. It is unfortunately a "conditio sine qua non", so if anyone here can think of a workaround please if you could let me know that would be great.

  • this is bugreport 58070

    [edit: Added link SGaist]

Log in to reply