Android Performance Checking and Solving(2 ) : ANR vs Crash

Previously on Frozen Frames story i tell a story about how to find and fixing Rendering Performance Issues (Slow Rendering and ANR).

This time i called Rendering Issues as ANR (Android Not Responding) issues.

Once you fixed ANR be aware of CRASH.

ANR Problem

1. ANR Problem

Code above explain that function initBitrate running on Main Thread. And inside initBitrate there is 1 line code that access diskAndroid SharedPreference. Which is this should be running on other Thread.

Fixing the ANR Issue

2. ANR Fixing

Code above explain that i move init bitrate into other Thread. and the ANR issue has solved.

New Problem

I got a new crash issue. that caused by ANR issue fixing.

3. Log of a crash that caused by ANR fixing

On that log, we found that i access List that at the other Thread that list got update. That causing Illegal State Exception.

Fixing The Crash

So now i try to fix the crash without causing ANR anymore.

4. Crash Fixing.

Short story.. i fix the crash with RX Java. I make sure the accessing and modify List object at the same Thread.


Sometimes if you want to fix ANR issues, fix carefully, Its not just move Thread from UI Thread to other Thread, but be aware of possibility Crash Issues.

at (




Still believe, can change the world with code..

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Fast Image Processing in Android With Halide

Keys in Flutter🔑

Part 3 — Single activity architecture + some funky Dagger

Low-latency live streaming with ExoPlayer

Diagram showing segments in a live stream with a low-latency playback position in the yet unfinished segment at the live edge

Things I learnt while developing shareit clone of Android app

Sign language recognition on Android with Intel OpenVINO

Bowshock — Spacerace ctf

Mobile System Design Exercise: File Downloader Library

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
ade sueb

ade sueb

Still believe, can change the world with code..

More from Medium

How to maintain Android code test coverage

Create a Simple Counter App : Kotlin Basics

How to Observe Network Connection Status

7 Pitfalls to avoid on your first Composable app