Вопрос

The parameters documentation for the XML configuration file used by the Google Analytics v4 SDK (as found in the Google Play Services 4.3.23 release) says that ga_dryRun and ga_logLevel are valid attributes in the tracker file. Here is my res/xml/default_tracker.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <bool name="ga_dryRun">true</bool>
    <string name="ga_logLevel">verbose</string>
</resources>

When I set this config file on a new tracker and run my app, I see the following in the log:

04-30 13:05:55.303  29266-29266/com.example.app W/GAV3﹕ Thread[main,5,main]: bool configuration name not recognized:  ga_dryRun
04-30 13:05:55.303  29266-29266/com.example.app W/GAV3﹕ Thread[main,5,main]: string configuration name not recognized:  ga_logLevel

Are there updated attribute names to use? Is configuring these features via XML no longer supported (they worked in the v3 SDK)?

I know I can set both the dry run and log level options from Java, but it would be nice to be able to define these in the XML files so I could use different files for different build variants.

Это было полезно?

Решение

From your setup, it looks like you are specifying the settings in a tracker configuration.

The values of ga_dryRun and ga_logLevel are global settings for the app and not specific to a particular tracker from v4 onwards. Can you make sure that you are following the steps written in the documentation here?

To quote, Use the following to setup the configuration:

In AndroidManifest.xml

 <meta-data
   android:name="com.google.android.gms.analytics.globalConfigResource"
   android:resource="@xml/analytics_global_config" />

In analytics_global_config.xml

 <?xml version="1.0" encoding="utf-8"?>
 <resources>
   <bool name="ga_dryRun">true</bool>
   <string name="ga_logLevel">verbose</string>
 </resources>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top