我在使用play-game服务时遇到了问题。仅进行简单连接时,我收到以下信息:
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