Slow app startup
Issue summary
Startup performance issues occur when the app takes too long to initialize, delaying the appearance of the first usable screen. This is often caused by heavy operations or blocking tasks running on the main thread during startup.
Platform target and tolerance:
- Target: 2.5 seconds
- Tolerance: up to 5 seconds
Why it matters
Slow startup times frustrate users, increase abandonment, and negatively affect ratings and retention. Optimizing startup boosts user satisfaction and improves the perceived quality of the app.
How severity is calculated
The platform calculates a severity score for startup issues based on how much the measured startup time exceeds the defined target and tolerance.
Severity | Definition |
---|---|
No issue raised | Startup time is below target (≤ 2.5 sec). No significant issue. |
Low–Medium | Startup time exceeds target but is within tolerance (2.5–5 sec). Gradual impact based on distance from midpoint. |
High–Critical | Startup time exceeds tolerance (> 5 sec). Score capped at 100, indicating maximum severity. |
How to fix a slow app startup issue
Since the Kotzilla platform has detected a startup performance problem, your focus should now be on investigating what’s happening during your app’s initialization, particularly within the onCreate
method of your Application class during and immediately after Koin is initialized.
Focus on:
- Deferring or breaking up what happens at app launch
- Reducing how much must be ready before the first screen shows
- Using lazy modules,
inject()
, and graph optimization to improve first-load performance
Recommended actions
-
Lazy Initialization
Koin creates singletons lazily by default, meaning instances are created only when first needed. Avoid forcing eager initialization accidentally throughcreatedAtStart()
or prematureget()
calls.To further improve startup performance, consider using
inject()
inside your classes to lazily obtain dependencies. This defers their creation until actually accessed, which is especially helpful for non-essential services like analytics or remote config. -
Lazy modules for deferring heavy initialization
Use Koin’s lazy modules feature to defer loading entire sets of dependencies until required. Combine this with background thread execution (i.e., coroutines onDispatchers.Default
) to keep startup smooth. -
Optimize the dependency graph
Even with lazy initialization, a complex or tightly coupled dependency graph can cause transitive eager loads.- Break down large dependencies into smaller parts
- Reduce unnecessary coupling between modules
- Isolate heavy or optional dependencies for lazy or asynchronous loading
This ensures only essential components are initialized at startup.
Use the Kotzilla SDK API and the Console to investigate
You can use the Kotzilla SDK API to add custom logs, trace execution time, and capture additional context during your app’s startup. This helps pinpoint heavy operations, measure performance of specific code blocks, and gather detailed diagnostics.
The information you log will appear in the user sessions Timeline view of the Kotzilla Console, providing a clear, chronological view of events to help troubleshooting.
Initialize the SDK in your startKoin
block and instrument critical startup code for deeper insights. For full usage details, see the Kotzilla SDK API documentation.
Need help?
Slow startup driving you crazy? Our experts are just a click away, reach out anytime for best practices and pro tips!