{
  "id": 17252361,
  "title": "Cold start in a 4.5 MB FOSS Android app: measure it with adb, then fix what's actually slow",
  "url": "https://urgent.news/2026/10/30/cold-start-in-a-4-5-mb-foss-android-app-measure-it-with-adb-then-fix",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-30T16:22:30.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/weavrikx/cold-start-in-a-45-mb-foss-android-app-measure-it-with-adb-then-fix-whats-actually-slow-2jfg"
  },
  "original_language": "en",
  "account": "This post demonstrates a practical method for improving the performance of a small, open-source Android app with a 4.5 MB APK size. The key points in the post are as follows:\n\n1. To accurately measure an app's cold start time, avoid tapping the app icon in a running state, as this gives an artificially favorable result. Instead, forcefully stop the app using adb, start the app, and record the time taken from launch to the first frame, known as \"ThisTime\" in AOSP's ActivityMetricsLogger. Repeat this process multiple times and discard the first run, then calculate the median value.\n\n2. The real culprit behind the app's slow cold start isn't necessarily its size but rather the numerous classes included in the release APK. In this case, the 4.5 MB APK contains an 8.4 MB classes.dex file, which is caused by not enabling R8's optimization and including unnecessary dependencies like Material Components and AppCompat.\n\n3. The post then delves into the actual code that contributes to the slowness. The main culprits are SharedPreferences read and JSON rewrite calls in the onCreate() method, as well as synchronous IPC (inter-process communication) calls to system_server in onResume(). These calls, being on the critical path, significantly impact the cold-start process.\n\n4. The author shares the recommended fixes in order of impact:\n- Enable R8 (a tool for APK optimization) in the release build configuration to strip unused classes and reduce the APK size.\n- Add a Baseline Profile to the app, which compiles hot paths into AOT-compiled code at installation time, resulting in faster app startup.\n- Offload IPC calls from the onResume() method to improve performance.\n- Avoid creating unnecessary Application subclasses, as their onCreate() methods run before the activity and add to the cold-start overhead.\n\n5. To verify the effectiveness of the implemented changes, repeat the cold start measurement process before and after each change. Track the median of 10 cold runs instead of the minimum value, and revert any changes that don't improve the median time.\n\nBy following this step-by-step process, the open-source Android app in question can be optimized, leading to faster cold starts and an improved user experience.",
  "summary": "Every \"make your app faster\" post opens with advice. This one opens with a number you can reproduce on your own device, because you can't fix a cold start you haven't measured. Here's the exact workflow I use on a 4.5 MB FOSS Android app, plus the two real things that were slowing its first frame. 1. Measure cold start with three commands (no Android Studio) A cold start means the process isn't…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}