Sub topic 7
Turning on debug mode in Android and iOS apps
Assume you already have a Firebase project connected to GA4 and an Android or iOS app data stream. Debug mode marks analytics events as test traffic so that DebugView can display them almost immediately. It does not replace the normal event collection setup. Your app must still initialize Firebase Analytics and send events.
Android: enable debug mode with adb
Android uses the Android Debug Bridge (adb) to send commands to a connected device or emulator. The command identifies your application by its package name.
# Turn on Firebase Analytics debug mode
adb shell setprop debug.firebase.analytics.app com.example.myapp
# Turn it off when testing is complete
adb shell setprop debug.firebase.analytics.app .none.Replace com.example.myapp with the package name in your Android app. The device must be connected, unlocked, and authorized for debugging. You can check the connection with adb devices.
After enabling the property, open or restart the app and perform the action that sends the event. Debug mode normally remains enabled for that package on the device until you disable it or reset the device property.
The setting applies to the selected device, not to every installation of the app. A second test device needs its own debug-mode setting.
iOS: enable debug mode from Xcode
For an iOS app, add a Firebase Analytics launch argument to the app's Xcode scheme:
- Open the project in Xcode.
- Choose Product > Scheme > Edit Scheme.
- Select Run, then open the Arguments tab.
- Add
-FIRDebugEnabledto Arguments Passed On Launch. - Run the app from Xcode and trigger the event.
To disable debug mode, remove the argument or replace it with -FIRDebugDisabled. Keep the setting in the development scheme rather than a production scheme. This prevents a release build launched from that scheme from being treated as debug traffic during testing.
| Platform | Enable setting | Disable setting |
|---|---|---|
| Android | `debug.firebase.analytics.app package.name` | `debug.firebase.analytics.app .none.` |
| iOS | `-FIRDebugEnabled` | `-FIRDebugDisabled` |
Confirm that the app is sending debug events
Open the GA4 property and select Admin > Data display > DebugView. Select the device that represents your test app. The device name may not be obvious when several developers are testing. Use one device at a time, or identify devices by their recent activity.
Perform a known action, such as opening a screen or completing a test sign-up. The event should appear in the selected device's timeline. Select the event to inspect its parameters and user properties.
Debug mode only affects events from the app instance where you enabled it. It does not make events from other devices appear in DebugView.
Exercise
Exercise
You enabled debug mode on an Android device, but events from a colleague's iPhone do not appear in the same DebugView device timeline. What should you check?
Show answer
Check that the iPhone was launched with -FIRDebugEnabled, that its events use the same GA4 property, and that DebugView has the iPhone's device selected. Debug mode is enabled separately for each app instance.