How to crash an Android app programmatically?

后端 未结 13 1488
遥遥无期
遥遥无期 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:09

    Force crash after some delay like this,

    new android.os.Handler().postDelayed(
                  new Runnable() {
                      public void run() {
                          Log.i("tag", "This'll run 10 seconds later");
                          throw new RuntimeException("This is a crash");
                      }
                  },
                  10000);
    

    Ref-1 & Ref-2

    0 讨论(0)
提交回复
热议问题