Skip to content
Advertisement

How to crash an Android app programmatically?

I want to test out crash report using acra but the first step is I need to simulate a fatal crash in Android using code.

Any idea?

Advertisement

Answer

Just execute this code: divide by zero

Update: Also can try this Create a method,

public void stackOverflow() {
    this.stackOverflow();
}

And call this somewhere/buttonClick

OR simply throw an uncaught exception

throw new RuntimeException("This is a crash");

Bingo!

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement