How to Measure Android App Start-up Time
App startup time is one of the most critical metrics for user experience. Users expect apps to launch quickly, and slow startup times directly correlate with user frustration, negative reviews, and app uninstalls. This guide covers how to accurately measure and track Android app startup performance.
Why Startup Time Matters
User Experience Impact:
- First impression of app quality
- Directly affects user retention
- Critical for app store ratings
- Competitive advantage in crowded markets
Google’s Recommendations:
- Cold start: Should complete in < 5 seconds
- Warm start: Should complete in < 2 seconds
- Hot start: Should complete in < 1.5 seconds
Business Impact:
- 1-second delay = 7% reduction in conversions
- 53% of users abandon apps that take > 3 seconds to load
- App store rankings consider startup performance
Understanding Startup Types
Cold Start
What it is: App launched from scratch with no cached data
When it happens:
- First launch after device boot
- App killed by system
- User force-stopped the app
What’s measured:
- Process creation
- Application.onCreate()
- First Activity creation and layout
- First frame drawn
This is the most important metric - represents worst-case scenario.
Warm Start
What it is: App process exists but Activity was destroyed
When it happens:
- User pressed back button (Activity destroyed but process alive)
- System reclaimed Activity due to memory pressure
What’s measured:
- Activity recreation
- Layout inflation
- First frame drawn
Hot Start
What it is: App already in memory, just brought to foreground
When it happens:
- User returns from recent apps
- User pressed home and returns quickly
What’s measured:
- Activity.onStart()
- Activity.onResume()
- Minimal work
Measurement Guidelines
What to Measure
Focus on Time to Initial Display (TTID):
- From app launch to first visible frame
- Excludes asynchronous data loading
- Represents perceived startup time
Not included:
- Network requests (unless blocking UI)
- Background work that doesn’t block rendering
- Splash screen animations (measure separately)
Best Practices
1. Minimize External Factors
1 | // ❌ BAD: Network calls in Application.onCreate() |
2. Account for Device Variables
Factors affecting measurements:
- CPU frequency and cores
- Available RAM
- System load (background apps)
- Android version
- Device thermal state
Solution: Test on multiple devices representing your user base.
3. Track Relative Changes
Instead of absolute times:
- Measure before/after optimization
- Track percentage improvement
- Compare across app versions
- Monitor trends over time
Example:
- Before: 1.2s average startup
- After optimization: 0.9s average
- Result: 25% improvement ← This is meaningful!
Method 1: ActivityManager via Logcat
The simplest and most common method using Android’s built-in logging.
Basic Measurement
Step 1: Clear Logcat
1 | adb logcat -c |
Step 2: Launch Your App
1 | adb shell am start-activity -W -n com.example.myapp/.MainActivity |
Parameters explained:
-W: Wait for launch to complete-n: Component name (package/activity)
Step 3: View Results
1 | adb logcat | grep "Displayed" |
Sample output:
1 | ActivityManager: Displayed com.example.myapp/.MainActivity: +856ms |
This shows your app took 856ms from launch to first frame.
Cold Start Measurement
To ensure a true cold start:
1 | # 1. Force stop app |
Filtering for Specific Activity
If your app has multiple activities:
1 | # Only show results for SplashActivity |
This ensures you’re measuring the first activity only, not subsequent navigations.
Full Bash Script
Save as measure_startup.sh:
1 |
|
Usage:
1 | chmod +x measure_startup.sh |
Sample output:
1 | Measuring cold start time for com.example.myapp |
Method 2: Android Benchmark Plugin
More sophisticated approach using androidx.benchmark for precise measurements.
Setup
Step 1: Add Dependencies
In app/build.gradle:
1 | dependencies { |
Step 2: Configure Benchmark
Create app/src/androidTest/AndroidManifest.xml:
1 |
|
Step 3: Create Benchmark Test
app/src/androidTest/java/com/example/StartupBenchmark.kt:
1 |
|
Running Benchmark
1 | # Run benchmark test |
Sample output:
1 | StartupBenchmark_startup |
Benefits over logcat method:
- Statistical analysis (min, median, max, percentiles)
- Automatic iteration handling
- Consistent environment control
- Integration with CI/CD pipelines
Command-Line Benchmark
For quick measurements without writing tests:
1 | adb shell am start-activity \ |
Advanced: Startup Profiling
For detailed analysis of what’s taking time:
Using Android Studio Profiler
- Run app in debug mode
- Open Profiler (View → Tool Windows → Profiler)
- Click “+” and select your process
- Click “CPU” and start recording
- Force stop app:
adb shell am force-stop com.example.myapp - Launch app: App should auto-attach to profiler
- Stop recording after first screen appears
Analyze results:
- Identify slow methods in Application.onCreate()
- Find blocking I/O operations
- Detect unnecessary initialization
Using Systrace
For system-level analysis:
1 | # Capture startup trace |
Open startup_trace.html in Chrome to analyze frame-by-frame rendering.
Precision Enhancement Strategies
1. Clear App Data Before Each Test
1 | adb shell pm clear com.example.myapp |
Why: Ensures consistent state, removes cached data.
2. Run Multiple Iterations
1 | # Run 10 times and average |
Why: Accounts for variability, provides statistical confidence.
3. Test on Same Device
Why: Different devices have vastly different performance characteristics.
Best practice:
- Test on low-end device (represents worst case)
- Test on mid-range device (represents majority)
- Test on flagship (represents best case)
4. Lock CPU Frequency (Rooted Devices)
1 | # Requires root |
Why: Prevents thermal throttling and frequency scaling from affecting results.
5. Use Real Devices, Not Emulators
Why:
- Emulators don’t accurately represent real device performance
- Missing hardware acceleration
- Different memory characteristics
Exception: Automated CI/CD testing (accept that times won’t match real devices).
6. Test at Same Time of Day
Why: Device background services vary by time (updates, syncs, etc.).
7. Minimize Background Apps
1 | # Close all apps |
Common Startup Performance Issues
1. Heavy Application.onCreate()
1 | // ❌ BAD: Blocking operations |
2. Synchronous I/O
1 | // ❌ BAD: Reading from disk on main thread |
3. Complex Layout Inflation
1 | <!-- ❌ BAD: Deeply nested layouts --> |
4. Custom Font Loading
1 | // ❌ BAD: Loading fonts synchronously |
Tracking Over Time
CI/CD Integration
Add to your CI pipeline:
1 | # .github/workflows/measure-startup.yml |
Firebase Performance Monitoring
Track startup in production:
1 | class MyApp : Application() { |
Benefits:
- Real user measurements
- Device distribution analysis
- Geographic breakdown
- Trend monitoring
Quick Reference
1 | # Cold start measurement |
Conclusion
Measuring Android app startup time is essential for delivering great user experiences. Key takeaways:
- Focus on cold start - It’s the worst-case scenario users experience
- Measure Time to Initial Display - From launch to first visible frame
- Use logcat for quick checks - Built-in and always available
- Use Benchmark library for precision - Statistical analysis and automation
- Run multiple iterations - Account for variability
- Clear app data between tests - Ensure consistent measurements
- Test on real devices - Emulators don’t represent real performance
- Track relative improvements - Percentage changes are more meaningful than absolute times
- Integrate with CI/CD - Catch regressions before release
- Monitor in production - Real user metrics reveal the truth
Remember: Every millisecond counts. Users notice the difference between 500ms and 1000ms startup times, even if they can’t quantify it. Faster startups lead to happier users, better ratings, and increased retention.