30
Views
5
Comments
How do I simulate/force a fatal crash in an Android App?
Application Type
Mobile

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

2024-12-04 09-29-36
Ricardo Real

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

UserImage.jpg
Shishir Shetty

Inside a client action I tried to divide by zero, but not exception occurred and the app didn't crash.

2021-06-02 20-50-04
Márcio Carvalho

You have a lot of examples here.

https://stackoverflow.com/questions/11807354/how-to-crash-an-android-app-programmatically

My favourite ones:

  1. Throw the device out the window.
  2. Submerge the device in water.


UserImage.jpg
Shishir Shetty

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.

2021-06-02 20-50-04
Márcio Carvalho

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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.