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?
For kotlin:
val test = ("0")
println(test[1])
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!
Don't declare activity in the Android Manifest .
You could try a Null Pointer exception.
Integer i = null;
Then invoke any method on the object.
i.byteValue();
Invoking a method on an object that hasn't been initialized will crash the app.
Most simple I know : throw null.
You can't throw null, so a NullPointerException is raised.
throw null;