How to enable the GA4/Firebase DebugView for Android apps
Want to know how to enable the GA4/Firebase DebugView for Android apps? Let’s take you through the process step-by-step!
1. Download and install Android Studio
You will need this to be installed even if the app is being developed in another framework or engine.
2. Connect the Android device via USB
Plug it in!
3. Find the adb (Android Debug Bridge) tool
This is via the Command Prompt for Windows (cmd.exe), or the Terminal app for MacOS.
Part of this install includes a tool called ADB (for “Android Debug Bridge”). It will be installed to your Android –> SDK folder –> Platform Tools Folder (which is referred to as [path_to_adb] below).
To get to that folder in the cmd/terminal window, use the command:
cd [path_to_adb]
Code language: CSS (css)
For me, on Windows was (assuming installed on C:):
cd C:\ProgramData\Microsoft\AndroidSDK\25\platform-tools
And on MacOS was:
cd /Users/mark/Library/Android/sdk/platform-tools
4. Run adb with the relevant parameters
This is achieved by typing the following in the terminal, with the command prompt being at the location of the adb (as found above):
adb shell setprop debug.firebase.analytics.app [package_name]
Code language: CSS (css)
So if the [package_name] is com.my.app, you would use:
adb shell setprop debug.firebase.analytics.app com.my.app
Code language: CSS (css)
(For MacOS, prefix the adb command with ./ to execute it.)
If you don’t know what the app’s package name is, you can run:
adb shell "pm list packages -f"
Code language: JavaScript (javascript)
To return a list of installed packages you can use to determine what the relevant package package name is.
If the app is available on the Google Play Store, you can also navigate to the app’s listing page via a web browser and look at the value for the id URL query string parameter. For example, play.google.com/store/apps/details?id=com.example.app123 where the app’s package name is com.example.app123.
5. Accept the connection on the device and verify
If the device hasn’t been verified, you may find running this command prompts a verification dialogue on the device.
If successful, you will be able to see the device listed by running the following:
adb devices