Firebase Crashlytics Integration in Mobile Applications
Crash on cold startup in 0.3% of users. Device logs show EXC_BAD_ACCESS without stack. Without Crashlytics, this means hours of searching: can't reproduce, device is different, iOS version is different. Crashlytics collects symbolicated stack trace, OS version, device, previous user actions and delivers it to console within minutes of crash.
SDK Connection
iOS via Swift Package Manager: add FirebaseCrashlytics from firebase-ios-sdk repository. Initialization happens automatically via FirebaseApp.configure() in AppDelegate or via @main + FirebaseOptions.
Mandatory step often skipped: dSYM upload. Without symbol files, Crashlytics shows memory addresses instead of function names. For automatic upload add run script in Build Phases:
"${PODS_ROOT}/FirebaseCrashlytics/run"
# or via SPM:
"${BUILD_DIR%Build/*}SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"
On Android SDK connects via Gradle plugin: id 'com.google.firebase.crashlytics' in app/build.gradle. ProGuard/R8 mapping uploads automatically on release build if firebaseCrashlytics { mappingFileUploadEnabled = true } is configured.
Custom Keys and Logs
Automatic crash report is baseline minimum. Real value is context around crash:
// iOS
Crashlytics.crashlytics().setCustomValue(userID, forKey: "user_id")
Crashlytics.crashlytics().setCustomValue("checkout", forKey: "last_screen")
Crashlytics.crashlytics().log("CartViewModel: starting checkout, items=\(cart.count)")
// Non-fatal error — lands in Crashlytics without app crash
Crashlytics.crashlytics().record(error: NetworkError.timeout)
// Android
Firebase.crashlytics.setCustomKey("user_id", userId)
Firebase.crashlytics.setCustomKey("last_screen", "checkout")
Firebase.crashlytics.log("CartViewModel: checkout, items=${cart.size}")
Firebase.crashlytics.recordException(NetworkTimeoutException("checkout API"))
recordException / record(error:) is powerful for tracking errors that don't crash app but affect UX: expired token, empty API response, broken deeplink.
ANR and non-fatal on Android
On Android, Crashlytics automatically captures ANR (Application Not Responding) from SDK 18.3+. If app hangs for >5 seconds, console gets ANR report with thread dump state. Separate from crashes, often related to main thread blocking via synchronous disk or network operations.
Crashlytics + Alerts
In Firebase console configure velocity alerts: if new version gets crash-free rate below threshold (usually 99.5%) within hour of release, email/Slack notification arrives. Catches regression before it hits entire audience.
Typical Integration Error
dSYMs don't upload for bitcode builds (relevant for old iOS projects). Apple recompiles bitcode on their servers, final symbols differ from local. Solution: in Firebase Console → Project Settings → App → "Upload dSYMs" upload archive manually, or configure fastlane with firebase_app_distribution plugin and upload_symbols_to_crashlytics.
What's Included in Work
- SDK connection (SPM / CocoaPods on iOS, Gradle on Android)
- Auto-upload setup for dSYM / mapping files
- Custom keys for context: user_id, screen, session state
-
recordExceptionfor non-fatal errors in key flows - Velocity alert in console
Timeline
Full integration with custom keys and non-fatal errors: 1 day. Cost estimated individually.







