Android - Forcing ANR for testing purpose

后端 未结 6 1124
花落未央
花落未央 2020-12-16 03:42

Why i can\'t force Android ANR with this code? No log messages or pop up. The application is just launched lazily.

[UPDATE]

I can\'t get it even sleeping a V

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-16 04:36

    Make a button in your activity.

    public void onBtn1(View v) {
       int a = 0;
       while(true) {
          a++;
       }
    }
    

    Make the button execute the above code. Spam click the button with your finger =)

提交回复
热议问题