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 (
>16msand>700ms) caused by expensive layouts, bind passes, or main-thread stalls. - Slow sessions (games only):
Measure frame pacing with
SurfaceFlingerand 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 viaoom_adj_scoreand 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
- Excessive wake locks: Avoid
holding partial wake locks for extended periods and migrate background tasks
to
WorkManagerorJobScheduler. - Stuck partial wake locks: Ensure every acquired partial wake lock is properly released across all execution and error paths.
- Excessive wakeups: Reduce exact alarm wakeups and batch or defer scheduled background work.
- Excessive background Wi-Fi scans: Minimize background Wi-Fi scanning frequency and use passive or batched location and connectivity APIs.
- Excessive background network usage:
Batch and defer background mobile network transfers using
WorkManagerconstraints. - Excessive battery usage: Diagnose high battery drain on mobile and Wear OS devices by profiling CPU, sensor, and radio activity.
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.