【问题标题】:GameAgent: Volley error when reporting playedGameAgent:报告播放时排球错误
【发布时间】:2016-11-16 16:45:08
【问题描述】:

我在玩游戏服务时遇到问题。对于一个简单的连接,我得到:

07-14 00:28:08.394 28271 28271 I gobandroid: connected
07-14 00:28:08.783 19165 19206 E Volley  : [1562] BasicNetwork.performRequest: Unexpected response code 401 for https://www.googleapis.com/games/v1/applications/played
07-14 00:28:08.789 19165 28324 W GameAgent: Volley error when reporting played
07-14 00:28:08.789 19165 28324 W GameAgent: com.android.volley.AuthFailureError
07-14 00:28:08.789 19165 28324 W GameAgent:     at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms:159)
07-14 00:28:08.789 19165 28324 W GameAgent:     at ipb.performRequest(:com.google.android.gms:64)
07-14 00:28:08.789 19165 28324 W GameAgent:     at com.android.volley.NetworkDispatcher.run(:com.google.android.gms:113)

对于这个初始化代码

  mGoogleApiClient = GoogleApiClient.Builder(activity).addConnectionCallbacks(object : GoogleApiClient.ConnectionCallbacks {
      override fun onConnected(bundle: Bundle?) {
          Log.i("connected")
      }

      override fun onConnectionSuspended(i: Int) {
         // Attempt to reconnect
         mGoogleApiClient!!.connect()
      }
  }).addApi(Games.API).addScope(Games.SCOPE_GAMES).build()

这是相关版本:

com.google.apis:google-api-services-games:v1-rev197-1.22.0

这也在日志中并且可能相关:

07-14 14:39:17.827  1736  4963 W GamesServiceBroker: Client connected with SDK 8487000, Services 9256436, and Games 37230036
07-14 14:39:17.943  1736  2302 V BaseAuthAsyncOperation: All scopes had been granted in the past, skip access token fetching
07-14 14:39:17.951  1012  1012 I Auth    : [AuthDelegateWrapper] Service intent: Intent { cmp=com.google.android.gms/.auth.account.authenticator.DefaultAuthDelegateService }.
07-14 14:39:17.952  1012  1012 I Auth    : [AuthDelegateWrapper] Service intent: Intent { cmp=com.google.android.gms/.auth.account.authenticator.DefaultAuthDelegateService }.
07-14 14:39:17.973  1012  1022 D GoogleCertificatesImpl: Fetched 318 Google certificates
07-14 14:39:18.023  1736  2302 V BaseAuthAsyncOperation: access token request successful
07-14 14:39:18.077   613  1644 W AppOps  : Bad call: specified package com.google.android.play.games under uid 10230 but it is really 10066

【问题讨论】:

    标签: android android-volley google-play-games


    【解决方案1】:

    请尝试使用 volley 库进行 HTTP 身份验证。

    这些 SO 帖子中给出的解决方案和解释 - com.android.volly.AuthFailureError in making basic volly POST request to a django serverHow does one use Basic Authentication with Volley on Android? 可能会有所帮助。快乐编码! :)

    【讨论】:

    • 我没有直接使用volley
    【解决方案2】:

    我认为这可能是您的Google API key 的问题; 在生成 API 密钥时,选择 Android-App 而不是 web-app

    希望对您有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-25
      • 1970-01-01
      • 2022-10-31
      • 2018-10-07
      • 2023-04-04
      • 2018-02-17
      • 1970-01-01
      • 2012-07-22
      相关资源
      最近更新 更多