将Firebase集成到Unity后无法在Android设备上运行

时间:2018-10-26 07:41:44

标签: firebase unity3d firebase-analytics

我有一个针对iOS和Android移动平台的Unity游戏项目。 与Firebase Analytics集成后,它停止在Android设备上运行,但仍在Unity Editor上运行。

对于集成,我只导入了FirebaseAnalytics.package,并添加了以下代码进行初始化:

    Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
        var dependencyStatus = task.Result;
        if (dependencyStatus == Firebase.DependencyStatus.Available)
        {
            Debug.Log("Enabling data collection.");
            FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
            Debug.Log("Set user properties.");
            FirebaseAnalytics.SetUserProperty(
            FirebaseAnalytics.UserPropertySignUpMethod,"Google");
            FirebaseAnalytics.SetMinimumSessionDuration(new TimeSpan(0, 0, 10));
            FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0));

        }
        else
        {
            UnityEngine.Debug.LogError(System.String.Format("Could not resolve all Firebase dependencies: {0}", dependencyStatus));
        }
    });

0 个答案:

没有答案