Use this with Android Studio Profiler (CPU, Memory, Energy) on a release build when possible.
- Avoid disk I/O, network, or heavy reflection in
Application.onCreateexcept what is required for the first frame. - Prefer lazy initialization (e.g. feature modules, background
CoroutineScopewithDispatchers.Default). - For numeric cold/warm start targets, add Macrobenchmark (
baseline-prof/Baseline Profile) in a separate:benchmarkmodule.
- Network and blocking I/O must use
Dispatchers.IO(or appropriate workers), never the main thread. - Do not use
runBlockingon the main thread. - Profile with CPU Profiler → Record → look for long-running methods on the main thread.
- Use Layout Inspector and recomposition counts to find unstable parameters.
- Prefer stable types for list items; use
keyinLazyColumn/LazyRow.
- Monitor Google Play Console → Android vitals → ANRs after release.
- Pair with Firebase Crashlytics (non-fatal breadcrumbs) for context around slow paths.
Always validate minify + shrinkResources (R8): proguard consumer rules are in app/proguard-rules.pro.