Android App Startup: From Cold to Hot

App startup has three types: cold, warm, and hot. Optimization focuses on the cold start—when the app launches from scratch. This is critical for user retention, as slow launches are a common reason for uninstalls. The footgun: don't just test warm starts.
Why it exists
Users expect apps to be instant. A slow launch is the first impression an app makes, and a bad one leads to frustration and uninstalls. The Android OS needs to create a process, load the app's code, create UI, and perform the first draw, all of which takes time and must be actively optimized.
The mental model
App startup isn't one thing; it's three distinct states. A COLD START is when the app's process doesn't exist in memory; the system builds everything from scratch. This is the slowest and most important to optimize. A WARM START is when the process exists, but the main activity must be recreated. A HOT START is when the app is already running in the background and is simply brought to the foreground. Your main enemy is the cold start.
How it works
During a cold start, the system performs a sequence of tasks: it creates a new process, loads the Application class and calls its onCreate(), launches the main thread, creates the main activity, inflates layouts, and performs the first draw. Each step is a potential bottleneck. Common culprits are heavy initialization in the Application class, complex view hierarchies that are slow to inflate, or synchronous I/O (disk or network) on the main thread. These blocking operations prevent the UI from being drawn, leaving the user staring at a blank screen.
When to use it
Startup optimization is crucial for any user-facing Android app. It's especially important for apps with large dependencies, complex initial screens, or those that need to perform network requests or database access at launch. Use tools like the Android Studio Profiler and Macrobenchmark library to measure startup time accurately and identify bottlenecks before you start changing code.
When not to use it
Don't prematurely optimize. Profile first. If your cold startup is already under 500ms, your time is better spent elsewhere. Shaving 50ms off a fast startup is less impactful than fixing a 5-second startup caused by a single blocking network call. Focus on the biggest, most obvious bottlenecks revealed by your profiling tools.
One canonical example
A common optimization is to move heavy initialization off the main thread. Instead of initializing a heavy analytics SDK or a complex object graph synchronously in your Application's onCreate(), you can use a library like the App Startup library to control initialization order and move non-essential tasks to a background thread. For dependency injection, you can inject a Lazy<MyManager> instead of MyManager directly, which defers the object's creation until it's actually used for the first time.
Interview question
Which characteristic primarily defines an Android app's "cold start" and makes it the most critical for optimization?
- a.The main activity needs to be recreated, even though the app's process is still running.
- b.It involves heavy initialization in the Application class and complex view hierarchies.
- c.The app's process does not exist in memory, requiring the system to build everything from scratch.Correct
- d.The app is brought from the background to the foreground, requiring UI redraws.
Why? this is the answer
A cold start is defined by the app's process not existing in memory, forcing the system to build everything from scratch, making it the slowest and most critical to optimize. While heavy initialization and complex view hierarchies (option B) are common bottlenecks during a cold start, they are not the defining characteristic of a cold start itself.
Just read this? Test yourself on what you have been reading.
Read the original → developer.android.com
- #android
- #performance
- #kotlin
- #startup
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on android — each one lists the topics its interview covers.
See open roles