Google Play服务无法统一运行。找不到类“ com.google.android.gms.games.Games”

时间:2019-12-22 13:58:39

标签: android unity3d google-play-services

Google Play服务不起作用。安装了最新版本的GPG插件。尝试了下面的版本,还有其他错误。在控制台中,我设置了Upload SHA1(用于测试)。发行版也有同样的错误。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;
public class PlayServices : MonoBehaviour
{

public static PlayServices instance;

const string leaderboardID = "*****";// leaderboard identificator

bool loginSucces;

private void Awake()
{
    instance = this;
    DontDestroyOnLoad(gameObject);
}

public void Start()
{
    Debug.Log("google play services initialization");
    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
    PlayGamesPlatform.InitializeInstance(config);
    PlayGamesPlatform.DebugLogEnabled = true;
    PlayGamesPlatform.Activate();
    LogIn();

}

public void LogIn()
{
    Debug.Log("Try login");
    Social.Active.localUser.Authenticate((bool success) =>
    {
        if (success)
        {
            Debug.Log($"Login is succes, account name{Social.localUser.userName}");
            loginSucces = true;
        }
        else
        {
        ...
        }
    });

}
}

Debug log from device

0 个答案:

没有答案