Address common performance issues

Delivering a smooth, stable, and battery-efficient app experience requires identifying and resolving common performance bottlenecks across stability, UI rendering, memory consumption, background work, startup latency, and build optimization.

The guides in this section explain the underlying Android platform behavior for each type of issue and walk through how to diagnose, profile, and remediate them using tools such as Android Studio Profiler, Perfetto, Logcat, and ApplicationExitInfo.

Stability

  • ANRs: Diagnose and fix Application Not Responding (ANR) errors caused by blocked UI threads, main-thread I/O, lock contention, or slow broadcast receivers.
  • Crashes: Read stack traces, inspect Logcat output, and prevent unhandled exceptions and native signals.

Rendering and startup

  • Slow rendering: Identify and fix dropped or frozen UI frames (>16ms and >700ms) caused by expensive layouts, bind passes, or main-thread stalls.
  • Slow sessions (games only): Measure frame pacing with SurfaceFlinger and optimize game frame rates using Android Frame Pacing (Swappy), Vulkan, and the Android Dynamic Performance Framework (ADPF).
  • App startup time: Understand cold, warm, and hot launch internals, measure Time to Initial Display (TTID) and Time to Full Display (TTFD), and optimize startup work.

Memory management

  • Low memory killers (LMKs): Understand how the Android Low Memory Killer daemon (lmkd) prioritizes processes via oom_adj_score and profile memory footprint in Android Studio, Unity, and Unreal Engine.
  • Memory usage (Anonymous RSS + swap): Measure and reduce your app's anonymous Resident Set Size (RSS) and swap memory footprint across foreground, service, and background states.
  • Bitmap memory usage: Diagnose oversized or leaked bitmap allocations and release graphic buffers when UI components move to the background.

Battery and background work

Permissions and build optimization

  • Permission denials: Request runtime permissions in context and explain permission rationale clearly to users.
  • DEX code optimization: Configure R8 shrinking, obfuscation, and optimization rules to reduce DEX size and improve runtime performance.