2013-11-22 40 views
6

當前嘗試將我的遊戲(使用libgdx)連接到Google遊戲服務以啓用排行榜/成就等,並看到一些奇怪的行爲。Google遊戲服務登錄問題(第一次嘗試失敗,成功第二次)

問題

當我在「登錄」第一挖掘,它顯示的對話框中選擇你的谷歌賬戶,然後播放服務許可界對話,那麼大的負載循環。一段時間後,它會顯示與谷歌以下錯誤未知問題的對話播放服務

如果我點擊「確定」取消該錯誤對話框,然後輕按「登錄」按鈕,再次,我立即得到成功登錄之後,我可以看到排行榜等

詳細

的錯誤日誌我看到:

... 
D: GameHelper: onActivityResult: req=RC_RESOLVE, resp=9001 
D: GameHelper: onAR: responseCode=9001, so giving up. 
D: GameHelper: killConnections: killing connections. 
D: GameHelper: killConnections: all clients disconnected. 
D: GameHelper: State change CONNECTING -> DISCONNECTED 
D: GameHelper: Making error dialog for failure: SignInFailureReason(serviceErrorCode:SIGN_IN_REQUIRED(4),activityResultCode:9001) 
D: GameHelper: Showing error dialog. 
D: GameHelper: Notifying LISTENER of sign-in FAILURE (error) 
I: ----- Sign in failed :(----- 
///// Tap the 'sign in' button again /////// 
I: ----- Begin sign in process... ----- 
D: GameHelper: Starting USER-INITIATED sign-in flow. 
D: GameHelper: isGooglePlayServicesAvailable returned 0 
D: GameHelper: beginUserInitiatedSignIn: starting new sign-in flow. 
D: GameHelper: Starting connections. 
D: GameHelper: State change DISCONNECTED -> CONNECTING 
D: GameHelper: connectNextClient: requested clients: 1, connected clients: 0 
D: GameHelper: Pending clients: 1 
D: GameHelper: Connecting GamesClient. 
D: GameHelper: onConnected: connected! client=1 
D: GameHelper: Connected clients updated to: 1 
D: GameHelper: connectNextClient: requested clients: 1, connected clients: 1 
D: GameHelper: Pending clients: 0 
D: GameHelper: All clients now connected. Sign-in successful! 
D: GameHelper: All requested clients connected. Sign-in succeeded! 
D: GameHelper: State change CONNECTING -> CONNECTED 
D: GameHelper: Notifying LISTENER of sign-in SUCCESS 
I: ----- Sign in success! ----- 
D: GameHelper: onActivityResult: req=3, resp=3 
D: GameHelper: onActivityResult: request code not meant for us. Ignoring. 
... 

由於我使用libgdx,我不延長BaseGameActivity相反,我手動創建GameHelper和使用,而不是

// in @Override onCreate: 
mGameHelper = new GameHelper(this);     
mGameHelper.setup(this, GameHelper.CLIENT_GAMES);  
mGamesClient = mGameHelper.getGamesClient();  

// in @Override onStart: 
mGameHelper.onStart(this); 

// then, for the sign in button, using it: 
mGameHelper.beginUserInitiatedSignIn(); 

額外的信息

我也看到了下面的日誌:

E: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. 

然而,不知道這是否是相關的,因爲從我」已經閱讀,這似乎與地圖/ GPS /位置有關。不使用的地圖,我能夠登錄,所以不知道這個錯誤是相關或不

更新/編輯(儘管它聽起來很糟糕!):經過測試,這個錯誤是造成由AdMob(我已經與谷歌服務集成)。雖然錯誤聽起來很糟糕,但禁用AdMob(沒有更多的錯誤),奇怪的行爲仍然是一樣的。

我認爲下面是有趣的錯誤日誌,雖然沒有太多的運氣谷歌搜索此錯誤:

E/dalvikvm(2618): Could not find class 'android.app.AppOpsManager', referenced from method axo.a 

編輯2:更多的發現!
即使我沒有瀏覽整個登錄工作流程,我也會得到相同的錯誤對話框。

  • 點擊「登錄」
  • 帳戶查看列表登錄到
  • 點擊「取消」
  • 看到一個標題/信息提示對話框:與谷歌未知問題上發揮服務

任何幫助將是偉大的!

注:

  • 這可以穩定地再生 - 註銷,以上
  • 確信我打電話onActivityResult被描述爲在Google Play Game Services: strange sign in behavior
  • 建議在登錄按鈕兩個水龍頭給人的行爲
  • 瀏覽本教程並設置示例應用程序(Type A Number) - 並且一切正常。

回答

2

想通了!它最終成爲一個愚蠢的錯誤!

@Override 
protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
    super.onActivityResult(requestCode, resultCode, data); 
    // mGameHelper.onActivityResult(requestCode, requestCode, data); // before - broken 
    mGameHelper.onActivityResult(requestCode, resultCode, data); // after - working! \o/ 
} 

看到區別? (提示:第二個參數mGameHelper.onActivityResult

爲了未來其他人的利益,以下日誌雖然可能表示其他錯誤,但不會影響登錄過程 - 或者一般的遊戲服務 - 我的排行榜正在工作:)

E/GooglePlayServicesUtil(10033):未找到Google Play服務資源。檢查您的項目配置以確保包含資源。
從我的調試中,這與使用AdMob和Google Play服務有關。 AdMob嘗試獲取基於位置的信息(所有其他谷歌搜索上述錯誤導致地圖相關問題)

E/dalvikvm(10100):找不到類'android.app.AppOpsManager',引用從方法axp.a
不知道這個錯誤是什麼。 android.app.AppOpsManager似乎是在API v19(AppOpsManager in Android Developer)中添加的類。我將我的SDK更改爲使用API​​ v19,但仍然出現此錯誤。文檔快速瀏覽表明它也有位置相關的功能(可能是AdMob再次 - 當我禁用AdMob時,我不認爲我看到了這個)

0

該應用程序必須使用相同的文件進行簽名並上傳到手機, ,爲了工作谷歌服務

相關問題