I am following this guide https://developers.google.com/analytics/devguides/collection/android/v4/ and it talks about creating a method in the Application class for getting the default tracker.
In getDefaultTracker() it has reference to R.xml.global_tracker. What it doesn't tell you is that this file is automatically generated when the json file is put into the root of the application module.
This works fine for a new project.
The problem
My existing project (which is currently using analytics V2) has product flavors so it doesn't make sense to put the json into the root of the application module as the package name and UA id is different for each flavor.
I've tried to get it to work in a new project (for simplicity) with product flavors and it doesn't work.
Possible solution
As I'm just upgrading from V2 is the auto-generated file the same as my existing analytics.xml. Both seem to contain the same attribute 'ga_trackingId'.
Can I just pass in the same xml into analytics.newTracker() and don't add the json at all. If this is the case can I also ignore the below two parts in my build script
classpath 'com.google.gms:google-services:1.4.0-beta3'
and
apply plugin: 'com.google.gms.google-services'
Bonus Question
I currently set the screen names in my analytics.xml
<string name="[full screen path]">[screen name]</string>
In V4 for tracking a screen it says
mTracker.setScreenName("Image~" + name);
Do I have to explicitly set the screen names in code now?