Google Analytics works on desktop but not on Android device

时间:2016-04-15 11:12:17

标签: android unity3d google-analytics admob google-play-services

I am trying to implement Google Analytics to my app. I can see hits when trying on Unity editor and also see real time users in analytics dashboard. However when I build my game on device I cannot see users on real time. I wait for a day no data has been sent from device.

    try {

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

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

    }

This return success both on desktop and device but on device no data sent. I search all similar questions but nothing helps ? Any idea what am I doing wrong ?

2 个答案:

答案 0 :(得分:1)

如果您的跟踪代码中包含空格新行,就会发生这种情况。

我建议您先从Unity删除当前的跟踪代码。现在,将跟踪代码从复制 记事本,然后将其直接从记事本复制到 Unity 。这样,您就可以确保在从网络上复制时,跟踪代码中没有空白新行

答案 1 :(得分:1)

  

找到日志。这里04-15 16:02:09.657:E / GMPM(12430):GoogleService初始化失败,状态:10,缺少预期的资源:' R.string.google_app_id'用于初始化Google服务。可能的原因是缺少google-services.json或com.google.gms.google-services gradle插件。

现在,当您阅读完日志后,您必须解决原因:错过了预期的资源:' R.string.google_app_id'

以下是GoogleService failed to initialize解决方案。