(240531) Medium Daily Digest

Godomin·2024년 5월 31일

Medium-Daily-Digest

목록 보기
10/24

ANR in Android & its types

https://medium.com/make-android/anr-in-android-its-types-cc1f6631ca1e

ANR이란 Application Not Responding, 즉 애플리케이션이 응답하지 않음을 의미한다. 사용자의 입력에 응답이 없음을 의미하기 때문에 사용자 경험에 매우 좋지 않다.

Android 프로세스 우선순위

  1. Foreground process
  2. Visible process
  3. Service process
  4. Background process
  5. Empty process

Input ANR

메인 스레드에서 5초 이상 지연이 계속되면 발생한다. 보통 IO 작업 등이 메인 스레드에서 일어날 경우에 해당한다.

Broadcast receiver ANR

onReceive 메서드를 실행하는 데 너무 많은 시간이 걸리는 경우 발생한다. 시간이 오래 걸리는 작업은 백그라운드 스레드에서 실행해야 한다.

Service ANR
서비스의 onStartCommand 또는 onHandleIntent 메서드에 과도한 계산이나 네트워크 요청과 같은 blocking이 포함되는 경우 발생한다.

Key dispatching timeout ANR

UI 컴포넌트가 메인 스레드에서 키 이벤트 핸들링을 할 때 너무 오래 걸리면 발생한다.

Input dispatching timeout ANR

짧은 시간에 많은 양의 UI 업데이트를 할 때 발생할 수 있다. UI 애니메이션 등이 원인이 된다.

0개의 댓글