Guides

App crashes on startup — 3 causes and how to check each one

Illustration: a door slamming shut right on the threshold

The cruellest detail of this bug is documented by Apple: when an app is launched from Xcode, the watchdog timer is disabled.

Read that again. It doesn't crash for you not because things are fine, but because the debugger switches off the exact mechanism that kills the app for your users. Apple even has a technical note titled, roughly, "application does not crash when launched from debugger but crashes when launched by user."

That's the shared property of all three causes below: your environment is a different, gentler one. Let's go through them, most common first.

Cause 1: the system kills you for a slow launch

A mobile OS gives an app a limited window to start. Miss it and the process is killed. In a crash report you'll see the code 0x8badf00d ("ate bad food" — Apple's engineers had a sense of humour). Apple doesn't publish the exact seconds and changes them between versions, but the order of magnitude is around twenty for launch, and other transitions have far tighter limits.

The trap: on your phone with fast Wi-Fi, startup takes a second. For a user on a subway train, the same request hangs until it times out.

How to check. Unplug the cable and launch the app from the device itself — by tapping the icon, like a normal person. If it only crashes that way, you've found it. Then find the crash report: on iPhone it's Settings → Privacy & Security → Analytics → Analytics Data; on Android, the Crashes section in Play Console.

How to fix. Remove everything that waits from your launch path: network calls, reading a big file, database migrations, heavy library init. The rule is simple — startup draws a screen, it doesn't load data. Data arrives afterwards with a spinner, and launch stops depending on the network.

Cause 2: the release build is a different program

On Android, code shrinking and renaming are enabled only in the release build — Google itself recommends turning optimization on only for the version you're about to publish. And it really is different bytecode: R8 removes unreachable code and shortens class names, so com.example.MyActivity becomes a.b.a.

Guess what breaks first. Everything that looks classes up by name at runtime: JSON parsing, serialization libraries, anything "magic." The tool can't see those references in the code, so it dutifully deletes the "unused" parts.

How to check. Build the release variant locally and run it on a device. If only that one crashes, this is your cause. The stack trace will be unreadable, all a.b.c — you decode it with the name-mapping file the build produces; Android Studio can retrace automatically, and Play Console takes the mapping file with each release.

How to fix. Add keep rules for classes accessed by name — usually your data models. And make it a habit: run the release build before you ship, not the debug one. Five minutes that remove a whole class of crashes.

On iOS the equivalent is milder but real: a debug build doesn't optimize and is more forgiving of a slow launch — see cause 1.

Cause 3: you install clean, they install an update

You install on top of your own previous build, or onto a clean device. Your user updates on top of a version that's six months old. And their disk holds things yours doesn't:

  • a database with the old schema;
  • saved settings in a format you've since changed;
  • cache from the previous version;
  • a login token your new code parses differently.

The app reads that at startup, hits an unexpected format and dies before it can draw a screen. The symptom is distinctive: new users are fine, only long-time users complain. And "reinstall the app" genuinely helps — because it wipes the data.

How to check. Install the previous version from the store or a test track, use it a bit so data is created, then install the new build on top without deleting. This scenario never reproduces by accident — you have to stage it.

How to fix. Write a migration for the changed data, and wrap reads of stored state in a check: if it can't be parsed, wipe it and start fresh — but don't crash. A user survives losing settings; they don't survive an app that won't open.

What to do if it's crashing right now

  1. Launch without the debugger, from the device. Reproduces? Go to the crash reports.
  2. Read the top lines: 0x8badf00d means cause 1; names like a.b.c mean cause 2; any mention of the database, settings or parsing means cause 3.
  3. Can't make sense of the trace? Feed it to a model along with a description of when it dies. The right way to do that is in how to read an error message.
  4. No cause after an hour — ship the previous version and investigate later. The server-side version of the same story is here: works locally but not in production.

Why does everything work in the simulator?

Because the simulator is your computer: fast CPU, fast disk, instant network, none of a phone's memory limits. It doesn't reproduce the watchdog, the slow launch or the memory pressure. Test startup on a real device — ideally not your newest one.

Only some users crash — how do I find the pattern?

Look at the breakdown in the crash reports: OS version, device model, app version. There's almost always a pattern — only people who upgraded from before 2.0, or only older models where startup is slower. That breakdown is a ready-made hypothesis; all you have to do is reproduce it.

Does wrapping startup in try/catch help?

As a stopgap, sometimes — at least the app opens. More often you're hiding the symptom: the screen appears, the data didn't load, and everything downstream falls apart. Handle the specific place where data can be unexpected, and decide right there what to do: reset it, rebuild it, or show a clear error.

Become an AI architect — don’t just read about AI

The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.

About the Academy
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →