How to crash an Android app programmatically?

后端 未结 13 1520
遥遥无期
遥遥无期 2021-02-05 00:37

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?

13条回答
  •  暖寄归人
    2021-02-05 01:02

    Most simple I know : throw null.

    You can't throw null, so a NullPointerException is raised.

    throw null;
    

提交回复
热议问题