Skip to content

Instantly share code, notes, and snippets.

@smyykb
Created January 16, 2018 07:45
Show Gist options
  • Save smyykb/bc8cb47f7cdd7e1050a2efe5edbc3d6a to your computer and use it in GitHub Desktop.
Save smyykb/bc8cb47f7cdd7e1050a2efe5edbc3d6a to your computer and use it in GitHub Desktop.
ANR vs Crash
ANR (A pplication N ot R esponding )is due to handling long running task in Main Thread(UI thread).If the main thread is stopped for more than 5 sec you get ANR.
Crash are due to exception and error like Nullpoint,classNotfound, typecast ,parse error etc. ANR also causes crash of application.
ANR and Crash Examples:
ANR:
// this will produce an ANR on your app
int i = 0;
while(true) {
i++;
}
Crash:
// this will crash your app : will produce java.lang.ArithmeticException
int value = 5, i = 0;
int result = value / i;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment