1

In firebase documentation, only this paragraph describes how to turn on debug mode for events,

"To enable Analytics Debug mode on an Android device, execute the following commands: adb shell setprop debug.firebase.analytics.app package_name"

however, I think that you can do it only in android studio.

How to turn on debug mode for firebase events in my Unity project?

5
  • 1
    You actually run this command from the command line after installing the Android SDK. Commented Aug 28, 2019 at 14:21
  • Oooh, when I test it on a plugged-in device or an emulator? Thank you! Commented Aug 30, 2019 at 8:47
  • 1
    Following up on @FrankvanPuffelen's comment, newer versions of Unity optionally install their own Android SDK. In this case, the path to ADB is {Unity_Installation_Directory}/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb I use Unity Hub and currently have 2019.2.3f1 installed. So the command without messing with my path or cd'ing to a weird directory would be: /Applications/Unity/Hub/Editor/2019.2.3f1/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb shell setprop debug.firebase.analytics.app package_name Commented Aug 30, 2019 at 16:29
  • 1
    It should work with a device or emulator. If you have a device plugged in and an emulator running, you would have to add an extra flag to select the device to execute the shell command in. Commented Aug 30, 2019 at 16:30
  • Sounds like you have enough for an answer there @Pux0r3! :-D Commented Aug 30, 2019 at 22:47

1 Answer 1

1

To wrap this all up in an answer. Using the Firebase SDK, you can execute adb shell setprop debug.firebase.analytics.app package_name to enable debug mode. Adb is a the "Android Debug Bridge", which exists on your machine if you're able to load games onto a phone (either via Android Studio or via Unity).

For finding your SDK location and setting your path, it depends on the host OS and shell you're running as well as how you've installed the Android SDK. Therefore, I'll try to give OS agnostic instructions for if you selected to install the Android SDK that ships in Unity 2019 (specifically 2019.2.3f1 as installed by Unity Hub).

In this case, the path to ADB is {Unity_Installation_Directory}/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb. So the command without messing with my path or cd'ing to a weird directory would be: /Applications/Unity/Hub/Editor/2019.2.3f1/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb shell setprop debug.firebase.analytics.app package_name

Now, I have Android Studio installed and I use my .profile file to set my path on OSX (I use the fish shell, so this is a little tricky). To make that version of ADB accessible as a command as indicated by the instructions page, I have this towards the end of the file:

# Add environment variable NDK_ROOT
export NDK_ROOT="/Users/username/Library/Android/sdk/ndk-bundle"
export ANDROID_SDK_ROOT="/Users/username/Library/Android/sdk"
export PATH=$NDK_ROOT:$PATH

But this is specific enough that I posted the general solution first.

Hope this helps!

--Patrick

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.