Google Play Game Services integration fails with “Play Games callback indicates connection failure.”

匿名 (未验证) 提交于 2019-12-03 01:18:02

问题:

I have integrated Google Game Services with my NDK game using the minimalist code example.

When starting the app, the authentication fails with this in the logs:

V/GamesNativeSDK( 7212): Play Games callback indicates connection failure. I/GamesNativeSDK( 7212): UI interaction required to connect to Google Play. I/TeapotNativeActivity( 7212): Sign in finished with a result of -3 I/biplane ( 7212): OnAuthActionFinished I/biplane ( 7212): You are not logged in! I/TeapotNativeActivity( 7212): Fetching all blocking I/TeapotNativeActivity( 7212): -------------------------------------------------------------- I/TeapotNativeActivity( 7212): Fetching all nonblocking I/TeapotNativeActivity( 7212): -------------------------------------------------------------- I/TeapotNativeActivity( 7212): Achievement response status: -3 

I've performed all the steps outlined in the online documentation, including:

  • Created a game service in Google Play Developer Console and linked two apps.
  • Linked app with Debug key
  • Linker app with Release key
  • Took the app-id from linked apps (same id for both linked apps) and put it in res/values/ids.xml
  • Created leaderboards, and put their IDs in res/values/game-ids.xml
  • Added tag to my AndroidManifest.xml with name="com.google.android.gms.games.APP_ID" and value="@string/app_id"
  • Downloaded latest update of Game Services app.
  • Listed myself as test user.

I am not sure which message is the original error, and which is a symptom. "Connection Failure" or "UI Interaction required".

Note that in the Developer Console, the two linked apps are listed as 'Ready to publish.'

The source code I use is a verbatim copy of StateManager.cpp from the c++ code examples, and in my android_main I have copied the example code snippet as well:

// gpg-cpp:  Here we create the callback on auth operations auto callback = [&](gpg::AuthOperation op, gpg::AuthStatus status) {     LOGI("OnAuthActionFinished");     if (IsSuccess(status)) {         LOGI("You are logged in!");     } else {         LOGI("You are not logged in!");     }     //engine.animating = 1; };  if (state->savedState != NULL) {     // We are starting with a previous saved state; restore from it.     engine.state = *(struct saved_state*)state->savedState;     LOGI("Restored state"); } else {     LOGI( "No saved state to restore." );     gpg::AndroidPlatformConfiguration platform_configuration;     platform_configuration.SetActivity(state->activity->clazz);     // Now, create the game service (see StateManager.cpp) and pass in callback     StateManager::InitServices(platform_configuration, NULL, callback); } 

回答1:

So, it turns out that this behaviour is intended: Auto logins (upon service start) are supposed to fail if you have never logged in before.

You need to do a user initiated login first, with:

game_services_->StartAuthorizationUI(); 

...before subsequent auto logins will succeed.

Also note that there are a lot of errors on the console, which do not seem to interfere with the proper functioning of the google play game service.

E/GamesNativeSDK(12369): Exception in dalvik/system/DexClassLoader.loadClass: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.games.NativeSdkEntryPoints" on path: DexPathList[[zip file "/data/data/com.steenriver.Biplane/app_.gpg.classloader/4da25210572e7e07ea67142ded62c42e.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]. W/dalvikvm(12369): Unable to resolve superclass of Lcom/google/android/gms/common/api/d; (148) W/dalvikvm(12369): Link of class 'Lcom/google/android/gms/common/api/d;' failed I/dalvikvm(12369): Could not find method com.google.android.gms.common.api.d.a, referenced from method com.google.android.gms.common.api.GoogleApiClient$Builder.gl W/dalvikvm(12369): VFY: unable to resolve static method 3084: Lcom/google/android/gms/common/api/d;.a (Landroid/support/v4/app/FragmentActivity;)Lcom/google/android/gms/common/api/d; D/dalvikvm(12369): VFY: replacing opcode 0x71 at 0x0002 W/dalvikvm(12369): VFY: unable to find class referenced in signature (Landroid/support/v4/app/FragmentActivity;) E/dalvikvm(12369): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.api.GoogleApiClient$Builder.enableAutoManage W/dalvikvm(12369): VFY: unable to resolve check-cast 149 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/api/GoogleApiClient$Builder; D/dalvikvm(12369): VFY: replacing opcode 0x1f at 0x0010 

One last note: Strangely, I've also seen the 'user interaction required' error when trying to login without a network connection.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!