Release health and alerting

Learn Android release health: Android vitals thresholds, Crashlytics velocity alerts, per-release crash and ANR rates, and halting a staged rollout. About 25 minutes.

Why it matters

  • A bad build that reaches every user at once can cause crashes or ANRs for all of them before anyone reacts. Staged rollouts plus alerts on per-release rates limit how many users are hit.
  • Senior interviews ask how you tell a real regression from noise, what you alert on, and who or what halts a rollout.
  • Android vitals core metrics affect your app's visibility on Google Play. Crossing the bad behavior thresholds (1.09% user-perceived crash rate, 0.47% user-perceived ANR rate overall) can reduce visibility and add a warning to your store listing.
  • Some exits never produce a crash report, such as low-memory kills. ApplicationExitInfo (API 30+) fills that gap on the next launch.

The simple explanation

  • A staged rollout is serving a new recipe to a few tables before the whole banquet.
  • A per-release crash rate is the share of those tables that sent the dish back. A raw count of complaints means nothing until you know how many tables were served.
  • A velocity alert is the head waiter noticing that one dish is coming back from many tables in the last half hour.
  • Halting a rollout stops serving the dish to new tables. Tables that already have it keep it until a corrected dish comes out.

What is release health on Android? It is the set of signals you compare between a new app version and the previous one to decide whether to continue, pause or halt a rollout. The core signals are the crash and ANR rates of that version, crash-free users or sessions, and performance and battery metrics, always as rates per release, never raw counts, because a 20% rollout naturally produces more crashes than a 5% one.

SignalSourceWhat it tells you
User-perceived crash ratePlay Console, Android vitalsShare of daily active users with a user-perceived crash. Bad behavior: 1.09% overall, 8% on any phone model
User-perceived ANR ratePlay Console, Android vitalsShare of daily active users with a user-perceived ANR. Bad behavior: 0.47% overall, 8% on any phone model
Excessive partial wake locksPlay Console, Android vitalsCore battery vital. Bad behavior: 5% of sessions overall
Crash-free users and sessions per versionCrashlytics or similarNear-real-time stability of the new version, including ANRs on Android 11+
Velocity alertsCrashlyticsOne issue affecting a set share of a version's sessions within 30 minutes
Exit reasonsApplicationExitInfo (API 30+)Why the process ended: REASON_CRASH, REASON_CRASH_NATIVE, REASON_ANR, REASON_LOW_MEMORY and more

Staged rollout. In Play Console you choose the percentage of users who get an update, and it does not increase automatically. A common ladder is a small percentage first, then larger steps, chosen by your team. Halting a rollout stops new users from receiving that version; users who already have it stay on it, so the real fix is a new release with a higher versionCode. You can halt from Play Console or with the Play Developer Publishing API by setting the release status to halted.

Alerting. Android vitals data arrives with a delay, so the first hours of a rollout are usually judged with near-real-time crash reporting. Crashlytics velocity alerts fire when a single issue crosses a percentage of a version's sessions and a minimum number of users within 30 minutes (by default 1% of sessions and 25 users). Add your own gate on the version's overall crash and ANR rates against the previous version, with a minimum sample size so a handful of early sessions cannot trigger it.

SLOs and error budgets. An SLO is a target you set, for example "99.8% crash-free sessions per release over 7 days". The error budget is the allowed failure (0.2% here). A burn-rate alert fires when the budget is being used faster than the window allows, which catches problems long before the 7-day number is breached.

ApplicationExitInfo. On API 30+, ActivityManager.getHistoricalProcessExitReasons() returns recent ApplicationExitInfo records with reason, status, importance, timestamp, description and, for ANRs (and native crashes on API 31+), getTraceInputStream(). Read them on the next launch and report the reasons Crashlytics does not cover, such as low-memory kills.

Notes

  • Android vitals bad behavior thresholds: user-perceived crash rate 1.09% overall and 8% per phone model; user-perceived ANR rate 0.47% overall and 8% per phone model. They are measured per daily active user.
  • Crossing a threshold can reduce your app's visibility on Google Play and add a warning on the store listing. It does not remove the app from the store.
  • Excessive partial wake locks is a core vital (5% of sessions overall). Slow rendering and excessive wakeups are reported in Android vitals too but are not core vitals.
  • Crashlytics velocity alerts are per issue and per version: a share of sessions plus a minimum number of users within 30 minutes. Both values are configurable.
  • Alert on rates for the new version compared with the previous one, never on raw crash counts, which grow with the rollout percentage.
  • Require a minimum number of sessions before a gate can decide, and treat "not enough data" as "do not increase yet".
  • Halting a staged rollout stops new installs of that version only. Users who already updated stay on it until you ship a higher versionCode.
  • The Play Developer Publishing API can halt a rollout (release status halted), so a scheduled job can act on an alert without waiting for a person.
  • ApplicationExitInfo (API 30+) gives reason, status, importance, timestamp and, for ANRs, getTraceInputStream(). REASON_LOW_MEMORY is reported only where isLowMemoryKillReportSupported() is true.
  • Production logs feeding release dashboards must be structured, levelled, sampled and free of PII. Plant Timber's DebugTree only in debug builds.
  • OpenTelemetry for Android is an official OpenTelemetry project for exporting traces, metrics and logs to your own backend. Many teams use Firebase Performance Monitoring and Crashlytics instead.

Code example

A release gate compares the candidate version's crash and ANR rates with the previous version and with the team's SLO ceilings, and a scheduled job halts the Play rollout when the gate says so.

import com.google.api.services.androidpublisher.AndroidPublisher
 
data class ReleaseStats(val versionCode: Long, val sessions: Long, val crashedSessions: Long, val anrSessions: Long) {
    val crashRate get() = crashedSessions.toDouble() / sessions
    val anrRate get() = anrSessions.toDouble() / sessions
}
 
data class GateConfig(
    val minSessions: Long = 5_000,         // below this, the rates are too noisy to act on
    val maxIncrease: Double = 1.5,         // candidate may be at most 1.5x the previous version
    val crashCeiling: Double = 0.005,      // team SLO ceilings, set well below Play's thresholds
    val anrCeiling: Double = 0.002,
)
 
sealed interface Verdict {
    data object Continue : Verdict
    data object WaitForData : Verdict
    data class Halt(val reason: String) : Verdict
}
 
fun evaluate(candidate: ReleaseStats, baseline: ReleaseStats, cfg: GateConfig = GateConfig()): Verdict {
    if (candidate.sessions < cfg.minSessions) return Verdict.WaitForData
    if (candidate.crashRate > cfg.crashCeiling) return Verdict.Halt("crash rate above SLO ceiling")
    if (candidate.anrRate > cfg.anrCeiling) return Verdict.Halt("ANR rate above SLO ceiling")
    if (candidate.crashRate > baseline.crashRate * cfg.maxIncrease) return Verdict.Halt("crash rate regressed")
    if (candidate.anrRate > baseline.anrRate * cfg.maxIncrease) return Verdict.Halt("ANR rate regressed")
    return Verdict.Continue
}
 
/** Runs on a server or CI job, never in the app. Halts the in-progress production rollout. */
fun haltProductionRollout(publisher: AndroidPublisher, packageName: String) {
    val edits = publisher.edits()
    val editId = edits.insert(packageName, null).execute().id
    val track = edits.tracks().get(packageName, editId, "production").execute()
    track.releases.filter { it.status == "inProgress" }.forEach { it.status = "halted" }
    edits.tracks().update(packageName, editId, "production", track).execute()
    edits.commit(packageName, editId).execute()
}
  • Every check uses rates for the candidate version, so a larger rollout percentage cannot trigger the gate by itself.
  • The ceilings are your own SLOs. Play's thresholds are measured per daily active user and are a line you never want to approach, not a target.
  • WaitForData keeps the rollout where it is until there are enough sessions; it does not count as healthy.
  • The halt goes through an edit (insert, tracks().update, commit), the same flow the Play Console uses. Users who already updated keep the version until a fixed build ships.

Run the idea in plain Kotlin

The same gate in plain Kotlin, run against four candidate snapshots of version 42 compared with version 41.

data class ReleaseStats(val versionCode: Long, val sessions: Long, val crashedSessions: Long, val anrSessions: Long) {
  val crashRate get() = crashedSessions.toDouble() / sessions
  val anrRate get() = anrSessions.toDouble() / sessions
}

data class GateConfig(
  val minSessions: Long = 5_000,
  val maxIncrease: Double = 1.5,
  val crashCeiling: Double = 0.005,
  val anrCeiling: Double = 0.002,
)

sealed interface Verdict {
  data object Continue : Verdict
  data object WaitForData : Verdict
  data class Halt(val reason: String) : Verdict
}

fun evaluate(candidate: ReleaseStats, baseline: ReleaseStats, cfg: GateConfig = GateConfig()): Verdict {
  if (candidate.sessions < cfg.minSessions) return Verdict.WaitForData
  if (candidate.crashRate > cfg.crashCeiling) return Verdict.Halt("crash rate above SLO ceiling")
  if (candidate.anrRate > cfg.anrCeiling) return Verdict.Halt("ANR rate above SLO ceiling")
  if (candidate.crashRate > baseline.crashRate * cfg.maxIncrease) return Verdict.Halt("crash rate regressed")
  if (candidate.anrRate > baseline.anrRate * cfg.maxIncrease) return Verdict.Halt("ANR rate regressed")
  return Verdict.Continue
}

fun main() {
  val v41 = ReleaseStats(41, sessions = 200_000, crashedSessions = 400, anrSessions = 100)
  val snapshots = listOf(
      "First hour" to ReleaseStats(42, 1_200, 5, 1),
      "Healthy" to ReleaseStats(42, 20_000, 44, 12),
      "Crash regression" to ReleaseStats(42, 20_000, 80, 12),
      "ANR spike" to ReleaseStats(42, 20_000, 44, 50),
  )
  for ((label, v42) in snapshots) {
      println(label + ": " + evaluate(v42, v41))
  }
}

Expected output:

First hour: WaitForData
Healthy: Continue
Crash regression: Halt(reason=crash rate regressed)
ANR spike: Halt(reason=ANR rate above SLO ceiling)

In production

ANRs rose while the crash dashboard stayed green
  • During a staged rollout, the new version's user-perceived ANR rate climbed well above the previous version's. Users reported the app freezing on cold start.
  • The rollout gate only looked at crash-free sessions, which had not changed, so nothing halted the rollout.
  • The new version migrated old settings from SharedPreferences to DataStore with runBlocking inside Application.onCreate, blocking the main thread on large data sets.
The fix
  • ANR traces from Play Console and Crashlytics showed the main thread waiting inside the migration. The team halted the rollout.
  • The migration now runs in DataStore's own SharedPreferencesMigration, which DataStore applies off the main thread before the first read, and nothing at startup blocks on it.
  • The release gate now checks the ANR rate per version as well as crashes, with the same minimum-sample rule.
Battery vital flagged with no crashes at all
  • Android vitals flagged excessive partial wake locks for the new version after a third-party SDK update.
  • Crash and ANR rates were normal, so the release dashboard showed green.
  • The wake lock breakdown in vitals listed a wake lock tag that belonged to the SDK, held for long periods in the background.
The fix
  • The team rolled the SDK back to the previous version in a new release and reported the issue to the vendor.
  • Excessive partial wake locks per version was added to the release review, next to crash and ANR rates.
  • SDK upgrades now go through a staged rollout of their own, with battery vitals checked before reaching full rollout.

Common mistakes

  • Alerting on raw crash counts. Counts grow with the rollout percentage and with traffic. Alert on rates for the new version compared with the previous version.
  • No minimum sample size. Two crashes in the first fifty sessions look like a disaster in percentage terms. Wait for enough sessions before a gate can halt or continue.
  • Relying on a person to notice. A 10% rollout can sit unwatched over a weekend. Wire alerts to a job that halts the rollout through the Play Developer Publishing API, and page someone.
  • Expecting halt to roll users back. Halting only stops new installs. Plan for a fast fix release with a higher versionCode, and use remote feature flags to switch off a broken feature.
  • Watching only crashes. ANRs, low-memory kills and battery vitals can regress while the crash rate stays flat. Track the ANR rate, ApplicationExitInfo reasons and core vitals per version.
  • Static threshold alerts on an SLO. "Alert when crash rate is above 1%" fires late. A burn-rate alert on the error budget warns while there is still time to act.
  • PII in release logs and custom keys. Emails or phone numbers in logs and Crashlytics keys create privacy exposure. Use random IDs and scrub at the source.

Interview questions

Answer out loud first. Then reveal the answer and compare it at each depth.

“How do you decide whether to halt a staged rollout?”

“What is ApplicationExitInfo and when would you use it?”

“How do you set up alerting for a new release?”

“What is the difference between a crash-rate alert and a Crashlytics velocity alert?”

Quiz

What is the overall Android vitals bad behavior threshold for user-perceived crash rate?

Which API gives your app the reason its previous process was killed by the system?

Why should a rollout gate alert on crash rate per version rather than on crash count?

What happens when you halt a staged rollout in Play Console?

0 of 4 answered

Mini task

15-minute exercise: Build a release-health gate

  1. In a scratch Kotlin project, create data class ReleaseStats(val versionCode: Long, val sessions: Long, val crashedSessions: Long, val anrSessions: Long) with computed crashRate and anrRate.
  2. Create a sealed interface Verdict with Continue, WaitForData and Halt(reason: String).
  3. Write fun evaluate(candidate: ReleaseStats, baseline: ReleaseStats): Verdict that:
    • returns WaitForData if the candidate has fewer than 5,000 sessions,
    • returns Halt if the candidate's crash rate is above 0.5% or its ANR rate above 0.2% (your SLO ceilings),
    • returns Halt if either rate is more than 1.5 times the baseline's,
    • returns Continue otherwise.
  4. In main(), evaluate four candidates against a baseline: too few sessions, healthy, a crash regression and an ANR spike. Print each verdict.
  5. Add a test that a candidate with twice the sessions and twice the crashes of a healthy candidate still returns Continue, proving the gate uses rates, not counts.

Done condition: all four cases print the expected verdict, the rates-not-counts test passes, and the function has no Android imports or I/O.

Next: Code review that teaches