Best way to setup Release/Debug Firebase Analytics environment

4,068 views
Skip to first unread message

Austyn Mahoney

unread,
May 26, 2016, 4:36:51 PM5/26/16
to Firebase Google Group
I am testing out Firebase Analytics and I don't want my debug data to go into the same pool as my release data. I cannot create a new app with the same package name, so how would I go about accomplishing this?

Doug Stevenson

unread,
May 26, 2016, 5:10:21 PM5/26/16
to Firebase Google Group
Austyn,

One thing you could try is using a different app id when compiling for debug.  The Android Gradle plugin lets you do this per-type by either specifying a whole new app id, or appending a suffix to the main app id.  Then you can create different projects in the Firebase Console for each instance with its own unique id.

There are some examples in the Android doc about build flavors here: https://developer.android.com/studio/build/build-variants.html

Please let me know if this works for you.  I have no tried this myself, but I suspect it will come up for others.

Doug

Doug Stevenson

unread,
May 26, 2016, 5:32:14 PM5/26/16
to Firebase Google Group
And actually, there is documentation on how to make this work correctly with respect to placing your google-service.json file per-type or per-flavor: https://developers.google.com/android/guides/google-services-plugin

Austyn Mahoney

unread,
May 26, 2016, 8:07:58 PM5/26/16
to Firebase Google Group
Thanks for the tips Doug.

I added an "applicationId" suffix to my debug buildType, and created a new app (in the same project) in Firebase with the debug package name. Now when you re-download google-services.json, it includes the necessary data for all your Android apps in the one file. This let's you place it in your main app module, so you don't have to create a debug src folder.

I have one followup question now:
Is the inclusion of all clients in google-services.json being deprecated now that the plugin searches each build variant for that file? It seemed redundant to place the same file in each build variant if it's exactly the same.

Doug Stevenson

unread,
May 27, 2016, 6:26:52 PM5/27/16
to Firebase Google Group
That I don't know for sure, sorry.  Actually I didn't know that the Firebase console gave you all your app configurations in a single google-services.json.  I suppose that this will be the Firebase way going forward.  It might be the case that older projects created in the Google Developer Console continue to have theirs separated into different files, and the plugin simply recognizes all of these possible variations.  I don't know of any plans to deprecate the all-in-one format since - but it seems easier to use than per-variant files distributed throughout your project.

Doug
Reply all
Reply to author
Forward
0 new messages