0

So I'm using the Unreal Engine 4 to make a mobile game. I'm currently trying to set up the Google Play services so I can do Leaderboards, Acheivements and In-App Purchases, but I'm struggling with the first right now.

You can see the behaviour in this short video.

It seems that it tries to contact the service then something goes wrong and it gives up. I made a logcat logfile from my phone while this was happening and this is what I got:

I/GamesNativeSDK(16078): Connecting to Google Play...

V/GamesNativeSDK(16078): Attached to JVM on thread main_dispatch

D/ChimeraCfgMgr(11916): Loading module com.google.android.gms.games from APK com.google.android.play.games

D/ChimeraModuleLdr(11916): Module APK com.google.android.play.games already loaded

D/ChimeraCfgMgr(11916): Loading module com.google.android.gms.games from APK com.google.android.play.games

D/ChimeraModuleLdr(11916): Module APK com.google.android.play.games already loaded

V/GamesNativeSDK(16078): Play Games callback indicates connection failure.

I/GamesNativeSDK(16078): UI interaction required to connect to Google Play.

D/UE4     (16078): [2015.10.26-19.31.29:804][  0]LogOnline:Warning: Async task 'Login' failed in 0.582350 seconds

E/SignInIntentService(11916): Access Not Configured. The API (Google Play Game Services API) is not enabled for your project. Please use the Google Developers Console to update your configuration.

E/SignInIntentService(11916): com.google.android.gms.games.server.error.GamesException

E/SignInIntentService(11916):  at com.google.android.gms.games.server.GamesServer.getResponseBlocking(GamesServer.java:164)

E/SignInIntentService(11916):  at com.google.android.gms.games.broker.PlayerAgent.getPlayerFromNetwork(PlayerAgent.java:1700)

E/SignInIntentService(11916):  at com.google.android.gms.games.broker.PlayerAgent.fetchPlayer(PlayerAgent.java:621)

E/SignInIntentService(11916):  at com.google.android.gms.games.broker.DataBroker.loadSelf(DataBroker.java:920)

E/SignInIntentService(11916):  at com.google.android.gms.games.service.PlayGamesSignInIntentService$LoadSelfOperation.executeInternal(PlayGamesSignInIntentService.java:402)

E/SignInIntentService(11916):  at com.google.android.gms.games.service.PlayGamesSignInIntentService$BaseOperation.execute(PlayGamesSignInIntentService.java:51)

E/SignInIntentService(11916):  at com.google.android.gms.games.service.PlayGamesSignInIntentService$OperationAdapter.execute(PlayGamesSignInIntentService.java:487)

E/SignInIntentService(11916):  at com.google.android.gms.chimera.BaseAsyncOperationService$OperationTask.run(BaseAsyncOperationService.java:179)

E/SignInIntentService(11916):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

E/SignInIntentService(11916):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

E/SignInIntentService(11916):  at java.lang.Thread.run(Thread.java:818)

E/LoadSelfFragment(16219): Unable to sign in - application does not have a registered client ID

I understand the error messages, but I don't understand why I get them. I tried to Deploy directly from the launcher as well as make a signed APK and install on my phone. It's the same result.

I looked around for a solution to this issue but I can't find any problems with the settings in my Developer Console nor anything missing. I'm a bit at a loss here and I'm aiming for a release in December 2015 so I need help. Epic Games had pretty much no documentation on the nodes provided to do this so all of this have been me fumbling in the dark.

First Part

Second Part

4

2 回答 2

2

在黑暗中经过多次挣扎和摸索后,我现在自己找到了解决方案。请点击此链接到虚幻论坛查看我是如何做到的!

它的基本要点是:

确保在您的开发者控制台中解锁了以下 API:

  • 适用于 Android 的 Google 云消息传递
  • 谷歌云发布/订阅
  • 谷歌云用户帐户
  • Google Play Android 开发者 API
  • Google Play 游戏管理
  • Google Play 游戏服务
  • 谷歌+ API

确保您的凭据中有一个公共服务器密钥,并且 IP 列表中没有 IP。

将以下两行添加到<manifest>项目设置的部分。

  • com.google.android.gms.games.APP_ID="@string/app_id"
  • com.google.android.gms.appstate.APP_ID="@string/app_id"

然后将所有这些权限添加到Extra Permissions项目的一部分

  • com.android.vending.BILLING(仅当您有应用内购买时)
  • android.permission.INTERNET
  • android.permission.GET_ACCOUNTS
  • android.permission.USE_CREDENTIALS

打开构建文件夹并在GooglePlayAppID.xml找到的<PROJECT NAME>\Build\Android\res\values添加您的应用程序 ID

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_id">YOUR GAMES APP ID HERE</string>
</resources>

现在您应该可以使用 Epic 提供的节点来实现成就、排行榜和应用内购买。

于 2015-10-28T21:37:53.700 回答
1

另一个重要步骤(在 Unreal Forum 链接中)是 YourProject.build.cs 的以下添加:

if (Target.Platform == UnrealTargetPlatform.Android)
{
    PrivateDependencyModuleNames.Add("OnlineSubsystem");
    PrivateDependencyModuleNames.Add("OnlineSubsystemGooglePlay");
}

来源:https ://forums.unrealengine.com/showthread.php?67343-How-do-I-debug-refusal-to-connecto-to-Google-Play-services

(其他平台可能需要 onlineSubsystem,例如 Windows/Steam)

于 2016-03-12T02:19:59.433 回答