Google Analytics 可以在桌面上运行,但不能在 Android 设备上运行

Google Analytics works on desktop but not on Android device

我正在尝试对我的应用实施 Google 分析。在 Unity 编辑器上尝试时,我可以看到命中率,还可以在分析仪表板中看到实时用户。但是,当我在设备上构建游戏时,我无法实时看到用户。我等待一天没有数据从设备发送。

    try {

        googleAnalytics.LogScreen(new AppViewHitBuilder()
            .SetScreenName("Main Menu"));;

        debuggerText.text = "Succes";
    } catch (System.Exception ex) {
        debuggerText.text = ex.ToString();

    }

此 return 在桌面和设备上均成功,但在设备上未发送任何数据。 我搜索了所有类似的问题,但没有任何帮助? 知道我做错了什么吗?

如果您的跟踪代码中有 white-spacenew line,就会发生这种情况。

我建议您先从 Unity 中删除当前的跟踪代码。现在,将您的跟踪代码从 Google/web 复制记事本,然后直接从 记事本 复制它到 Unity。这将确保您在从网络复制跟踪代码时没有 white-spacenew line .

find the logs. Here 04-15 16:02:09.657: E/GMPM(12430): GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.

现在,当您阅读日志后,您必须修复原因:缺少预期的资源:'R.string.google_app_id'

这是解决方案。