如何配置试运行,并通过XML在谷歌Analytics(分析)V4 SDK为Android日志级别的选择? [英] How to configure dry run and log level options via XML in Google Analytics v4 SDK for Android?
问题描述
的<一个href="https://developers.google.com/analytics/devguides/collection/android/v4/parameters">parameters对于所使用的谷歌Analytics(分析)V4 SDK(如谷歌播放服务4.3.23版本中)的XML配置文件的文件说, ga_dryRun
和 ga_logLevel
是跟踪文件有效属性。这是我的 RES / XML / default_tracker.xml
:
&LT; XML版本=1.0编码=UTF-8&GT?;
&LT;资源&GT;
&LT;布尔名=ga_dryRun&GT;真&LT; /布尔&GT;
&LT;字符串名称=ga_logLevel&GT;详细&LT; /串&GT;
&LT; /资源&GT;
当我设置的配置文件上的一个新的跟踪和运行我的应用程序,我看到下面的日志中:
04-30 13:05:55.303 29266-29266 / com.example.app W / GAV3:螺纹[主,5,主]:BOOL配置名称无法识别:ga_dryRun
04-30 13:05:55.303 29266-29266 / com.example.app W / GAV3:螺纹[主,5,主]:字符串配置名称无法识别:ga_logLevel
是否有更新的属性名称使用?配置是通过XML不再支持这些功能(他们在第三版SDK工作)?
我知道我可以同时设置预演和日志从Java级别选项,但它会很高兴能够在XML文件中定义这些,所以我可以用不同的文件不同版本的变种。
从你的设置,它看起来像你在跟踪器配置指定的设置。
的值 ga_dryRun
和 ga_logLevel
是应用程序的全局设置,而不是具体的从V4特定跟踪器起。你能确保你在下列书面文档<一中的步骤href="https://developer.android.com/reference/com/google/android/gms/analytics/GoogleAnalytics.html">here?
要引用,请使用以下设置配置:
在AndroidManifest.xml中
&LT;元数据 机器人:名称=com.google.android.gms.analytics.globalConfigResource 机器人:资源=@ XML / analytics_global_config/&GT;
在analytics_global_config.xml
&LT; XML版本=1.0编码=UTF-8&GT?; &LT;资源&GT; &LT;布尔名=ga_dryRun&GT;真&LT; /布尔&GT; &LT;字符串名称=ga_logLevel&GT;详细&LT; /串&GT; &LT; /资源&GT;
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>
这篇关于如何配置试运行,并通过XML在谷歌Analytics(分析)V4 SDK为Android日志级别的选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!