当前位置: 动力学知识库 > 问答 > 编程问答 >

android - My App has no Client ID?

问题描述:

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.

网友答案:

After much struggle and fumbling in the dark I've now found the solution myself. Please follow this link to the Unreal Forums to check out how I did it!

The basic gist of it is:

Make sure the following APIs are unlocked in your developer console:

  • Google Cloud Messaging for Android
  • Google Cloud Pub/Sub
  • Google Cloud User Accounts
  • Google Play Android Developer API
  • Google Play Game Management
  • Google Play Game Services
  • Google+ API

Make sure you have a public server key in your credentials with no IP's in the IP list.

Add the following two lines to the <manifest> part of the project settings.

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

Then add all of these permissions to the Extra Permissions part of the project

  • com.android.vending.BILLING (only if you have in-app purchases)
  • android.permission.INTERNET
  • android.permission.GET_ACCOUNTS
  • android.permission.USE_CREDENTIALS

Open up the build folder and in the GooglePlayAppID.xml found at <PROJECT NAME>\Build\Android\res\values add your apps ID

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

Now you should be able to use the nodes provided by Epic to make Achievements, Leaderboards and In-app purchases work.

网友答案:

Another essential step (which is in the Unreal Forum link) is the following addition to YourProject.build.cs:

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

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

(onlineSubsystem might be required for other platforms, such as Windows/Steam)

分享给朋友:
您可能感兴趣的文章:
随机阅读: