Skip to content

Comments

Disable Crashlytics and Analytics data collection in debug builds#1054

Merged
aaronbrethorst merged 1 commit intoOneBusAway:mainfrom
diveshpatil9104:fix/disable-crashlytics-in-debug-builds
Feb 22, 2026
Merged

Disable Crashlytics and Analytics data collection in debug builds#1054
aaronbrethorst merged 1 commit intoOneBusAway:mainfrom
diveshpatil9104:fix/disable-crashlytics-in-debug-builds

Conversation

@diveshpatil9104
Copy link
Contributor

@diveshpatil9104 diveshpatil9104 commented Feb 19, 2026

fixes #632

Summary

Debug builds are currently sending crash reports and analytics events to Firebase, creating noise in the production Crashlytics dashboard. This PR disables data collection in debug builds.

Problem

FirebaseApp.configure() in FirebaseAnalytics.init runs unconditionally for all build configurations. This means every simulator run and debug session sends data to Crashlytics, making it harder to identify real user crashes in the Firebase console.

Fix

Added a #if DEBUG block after FirebaseApp.configure() that disables both Crashlytics and Analytics collection:

#if DEBUG
Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(false)
Analytics.setAnalyticsCollectionEnabled(false)
#endif

Firebase is still configured (preventing crashes from unconfigured Firebase calls), but no data is collected or transmitted in debug builds.

Testing

  • Verified debug builds no longer send crash reports to Firebase console

Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Divesh — clean surgical fix. The #if DEBUG placement is correct: it runs after FirebaseApp.configure() (so Firebase doesn't crash from being unconfigured) but before Analytics.setUserID (which becomes a no-op once collection is disabled). I verified that setReportingEnabled(_:) only toggles Analytics, not Crashlytics, so the Crashlytics disable stays in effect for the entire debug session. And the only call site for setReportingEnabled is SettingsViewController, meaning a developer would have to deliberately re-enable analytics from the Settings UI — that's perfectly acceptable.

This looks good to merge. Thanks for keeping the production dashboards clean!

@aaronbrethorst aaronbrethorst merged commit d76d528 into OneBusAway:main Feb 22, 2026
2 checks passed
@diveshpatil9104 diveshpatil9104 deleted the fix/disable-crashlytics-in-debug-builds branch February 23, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable Crashlytics when debugging

2 participants