Flagship · Android library
2.1 FireCrasher
Catch an uncaught exception on the main thread and get the user back to a working screen.
Status
- 2.x on JitPack
- 3.0 on master
FireCrasher replaces Android’s main-thread message loop with one that dispatches each message inside a try/catch. When something throws, your onCrash handler gets the exception first, so crash reporting still works, and then the library recovers in steps. The main-loop interception is adapted from SafeLooper (mmin18, 2013); the recovery ladder, back-stack tracking and handler API are FireCrasher’s own. I started it in 2016 and moved most of it to Kotlin in 2019. It was modernized, and made fully Kotlin, in 2026.
- Recovery ladder: the first two crashes restart the activity. The third goes back if there is a screen behind it, and relaunches the app from its launcher activity if there isn’t.
- On API 30+, the recovery level and retry count are saved with the process (a 5-byte state summary). If the process dies mid-recovery and the app relaunches within 30 seconds, the next crash picks up the ladder where it left off. (On master.)
- Native crashes and ANRs kill the process before any handler runs. On API 30+, FireCrasher reads the system’s exit record on the next launch and passes it to
onPreviousProcessExit { }.context.lastAbnormalExit()andcontext.query the same records on demand. (On master.)historicalExitReasons() - The public API is locked down with Kotlin explicit-API mode and a committed binary-compatibility baseline, both checked on every CI build. 34 JUnit and Robolectric tests. (On master.)
- 7 merged pull requests from 5 outside contributors, 2016 to 2022.
installFireCrasher {
onCrash {
FirebaseCrashlytics.getInstance().recordException(throwable) // or Sentry, Bugsnag, …
recover()
}
}
Report the crash first, then recover. This DSL is on master and isn’t in a tagged release yet.
repositories { maven { url 'https://jitpack.io' } }
dependencies {
implementation 'com.github.osama-raddad:FireCrasher:2.0.0'
}
2.0.0 is the newest release with a clean JitPack build (2.0.1’s build is marked as failed). Like 2.0.1, it uses the 2.x CrashListener API.