What is the difference between ANR and crash in Android?

前端 未结 13 2218
北海茫月
北海茫月 2020-12-07 22:56

I have searched on the internet regarding what an ANR is. And I studied those references as well. But I don\'t get details regarding a crash in Android.

Can someone

13条回答
  •  执笔经年
    2020-12-07 23:24

    ANR stands for Application Not Responding.

    It can occur due to many reasons like if an application blocks on some I/O operation on the UI thread so the system can’t process incoming user input events. Or perhaps the app spends too much time building an elaborate in-memory structure or computing the next move in the UI thread.

    Blocking the main thread, won't result in a crash, but a popup will be displayed to let users kills the app after 5 seconds.

    But For Crash, the main reason is the human errors. Most of the time an app crashes is because of a coding/design error made by human

    Human Errors

    Lack of testing

    Null Pointer exception

    OutofMemory

    Example :

    This is common when a programmer makes a reference to an object or variable that does not exist, basically creating a null-pointer error.

    If you have a bad connection, that can also make your apps crash. The app could also have memory management problems.

    Please see my answer for the type of android specific exception which may cause the crash.

    Android Specific Exception

提交回复
热议问题