Unity中的Google Play游戏服务无法验证

时间:2020-04-03 14:05:53

标签: unity3d authentication google-oauth google-play-games

GPG服务不起作用

它显示了本机GPG窗口,但是在关闭后,PlayGamesPlatform.Instance.Authenticate()回调返回NetworkError

在Google Play控制台中: 创建了“游戏服务”。

  • 在“游戏详细信息”部分中,添加了512x512和1024x500图标的说明。

  • 在“链接的应用程序”部分中,添加了一个android应用程序并完成了身份验证(自动创建了OAuth 2.0密钥)

  • 在“成就”部分中,创建了一个带有说明和512x512图标的成就。

  • 在“测试”部分中添加了一个用于测试的gmail帐户

  • 在“发布”部分中,单击“发布”。

在Google API中:

  • 激活的Google Drive API和Google Play Android开发人员API(不创建任何密钥)

  • 在Android的OAuth密钥和“发布管理”>“应用程序唱歌”>“应用程序签名证书”中检查了SHA-1

在Unity中:

  • https://github.com/playgameservices/play-games-plugin-for-unity

  • 下载了最新版本
  • 在“窗口”>“ Google Play游戏”>“设置”>“ Android安装程序”中,使用“获取资源”链接从Google Play控制台的“成就”部分复制了xml格式的文本,ClientID格式为123456789123456-fffffffffffffffffffffffffffff。 apps.googleusercontent.com

使用与公司名称和产品名称相同的Google Play上发布的应用程序相同的密钥对测试版本进行签名

PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.RequestIdToken()
.Build();

PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();

PlayGamesPlatform.Instance.Authenticate(SignInInteractivity.CanPromptAlways, ((SignInStatus status) =>
{
        if (status == SignInStatus.Success)
        {
            print( $"Welcome {PlayGamesPlatform.Instance.GetUserDisplayName()}\n");
        }
        else
        {
            print($"Fail:{status}");
        }
}));

在Unty Console中进行调试时,

<i>AndroidPlayer(ADB@127.0.0.1:34999)</i> Returning an error code.
 #0 0x443df5a (libunity.so) GetStacktrace(int) 0x25
 #1 0x4e788b6 (libunity.so) DebugStringToFile(DebugStringToFileData const&) 0x169
 #2 0x49875fe (libunity.so) DebugLogHandler::Internal_Log(LogType, LogOption, core::basic_string<char, core::StringStorageDefault<char> >, Object*) 0x65
 #3 0x498754e (libunity.so) DebugLogHandler_CUSTOM_Internal_Log(LogType, LogOption, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*) 0xb5

1 个答案:

答案 0 :(得分:0)

我刚刚看到了这个。我有同样的错误。我要解决的问题是在项目设置中调低了字节码剥离的范围。当我检查统一的开发者控制台时,我注意到该错误,指出我的游戏找不到GooglePlayGames的库。

虽然这不是理想的答案,但这是一个临时解决方案。理想的答案是创建一个Link.xml文件,该文件告诉编译器不要删除库.so文件。 (这是我目前正在搜索的内容,以及我是如何遇到您的问题的。)