How do I simulate/force a fatal crash in an Android App?
I need to test a plugin that reports crashes on my Android app. Is there any way I can simulate a crash so that I can check the plugin works as expected?
Best,
Shishir
Hello Shishir,
Have you tried to execute an action that divides by zero or that throws an Exception that is not handled?
Let me know if this helped you.
Kind regards,
Ricardo
Inside a client action I tried to divide by zero, but not exception occurred and the app didn't crash.
You have a lot of examples here.
https://stackoverflow.com/questions/11807354/how-to-crash-an-android-app-programmatically
My favourite ones:
Tried throwing RuntimeException, but looks like some CordovaPlugin class catches this Exception internally and doesn't crash the app.
Will try throwing the device out the window, hope someone doesn't catch it just like other Exceptions.
Even loops don't crash?
"Will try throwing the device out the window, hope someone doesn't catch it just like other Exceptions. " Good one :DDD