java - 添加第二个 API 时 GoogleApiClient 崩溃

标签 java android google-api

我已经实现了 google 登录,但是当我尝试添加排行榜时,它立即崩溃,我已经无法读取 google 结果了。

当我构建这样的 API 时,我的应用程序成功登录:

private GoogleApiClient buildGoogleApiClient() {

return new GoogleApiClient.Builder(this)
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
    .addApi(Plus.API, Plus.PlusOptions.builder().build())
    .addScope(Plus.SCOPE_PLUS_LOGIN)
    .build();
}

但是这个版本会使应用程序崩溃:

  private GoogleApiClient buildGoogleApiClient() {
  return new GoogleApiClient.Builder(this)
  .addConnectionCallbacks(this)
  .addOnConnectionFailedListener(this)
  .addApi(Plus.API, Plus.PlusOptions.builder().build()).addScope(Plus.SCOPE_PLUS_LOGIN)
  .addApi(Games.API).addScope(Games.SCOPE_GAMES)
  .build();
  }

这是崩溃时 LogCat 中的输出:

    12-23 15:09:43.613: D/AbsListView(11516): Get MotionRecognitionManager
    12-23 15:09:43.643: W/PopupManager(11516): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
    12-23 15:09:43.673: D/Activity(11516): #1 setTransGradationModeColor false
    12-23 15:09:43.764: I/Adreno-EGL(11516): <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build:  (CL3869936)
    12-23 15:09:43.764: I/Adreno-EGL(11516): OpenGL ES Shader Compiler Version: 17.01.11.SPL
    12-23 15:09:43.764: I/Adreno-EGL(11516): Build Date: 01/17/14 Fri
    12-23 15:09:43.764: I/Adreno-EGL(11516): Local Branch: 
    12-23 15:09:43.764: I/Adreno-EGL(11516): Remote Branch: 
    12-23 15:09:43.764: I/Adreno-EGL(11516): Local Patches: 
    12-23 15:09:43.764: I/Adreno-EGL(11516): Reconstruct Branch: 
    12-23 15:09:43.794: D/OpenGLRenderer(11516): Enabling debug mode 0
    12-23 15:09:43.854: D/AndroidRuntime(11516): Shutting down VM
    12-23 15:09:43.854: W/dalvikvm(11516): threadid=1: thread exiting with uncaught exception (group=0x417d3da0)
    12-23 15:09:43.854: E/AndroidRuntime(11516): FATAL EXCEPTION: main
    12-23 15:09:43.854: E/AndroidRuntime(11516): Process: com.flung.patryk, PID: 11516
    12-23 15:09:43.854: E/AndroidRuntime(11516): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at com.google.android.gms.internal.jl$h.b(Unknown Source)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at com.google.android.gms.internal.jl$h.g(Unknown Source)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at com.google.android.gms.internal.jl$b.hy(Unknown Source)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at com.google.android.gms.internal.jl$a.handleMessage(Unknown Source)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at android.os.Handler.dispatchMessage(Handler.java:102)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at android.os.Looper.loop(Looper.java:146)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at android.app.ActivityThread.main(ActivityThread.java:5635)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at java.lang.reflect.Method.invokeNative(Native Method)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at java.lang.reflect.Method.invoke(Method.java:515)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
    12-23 15:09:43.854: E/AndroidRuntime(11516):    at dalvik.system.NativeStart.main(Native Method)

最后,这是我启用的 API

enter image description here

非常感谢任何帮助!谢谢!

最佳答案

再次检查你的元数据~再次检查

<meta-data android:name="com.google.android.gms.games.APP_ID"
            android:value="@string/app_id" />

关于java - 添加第二个 API 时 GoogleApiClient 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27628365/

相关文章:

java - 在 ViewHolder 中加载 Imageview

java - 如何在使用音乐服务时停止后台音乐

java - 如何在android中获取谷歌地图蓝点纬度和经度

java - 如何优化倒排文件的全文索引?

java - Android - 扩展泛型类

java - Spring mvc 从 formBackingObject() 重定向到一个页面

java - Firebase 检查用户名是否存在

javascript - 如何从我自己的 GMail 访问 GMail API?

android - 在 Google Places Android API 中将自动完成搜索限制在特定国家/地区

android - com.google.android.gms.location.places.ui.PlaceAutocompleteFragment 无法在 com.google.android.gms :play-services-location:9. 4.0 中解析