2015-05-24 440 views
0

我正在使用適用於C++版本1.4.1的Google Play遊戲服務。在我JNI_OnLoad我打電話Google Play遊戲服務C++無法註冊課程

gpg::AndroidInitialization::JNI_OnLoad(vm); 

下列錯誤通話效果,在此之後,登錄不起作用:

05-25 21:49:26.027: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/ConnectionResult: an exception occurred. 
05-25 21:49:26.028: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/GooglePlayServicesUtil: an exception occurred. 
05-25 21:49:26.028: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/api/Api: an exception occurred. 
05-25 21:49:26.028: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/api/Api$ApiOptions: an exception occurred. 
05-25 21:49:26.029: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/api/Api$ApiOptions$HasOptions: an exception occurred. 
05-25 21:49:26.029: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/api/GoogleApiClient: an exception occurred. 
05-25 21:49:26.030: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/api/GoogleApiClient$Builder: an exception occurred. 
05-25 21:49:26.030: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/api/PendingResult: an exception occurred. 
05-25 21:49:26.030: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/api/Result: an exception occurred. 
05-25 21:49:26.034: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/api/ResultCallback: an exception occurred. 
05-25 21:49:26.034: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/api/Scope: an exception occurred. 
05-25 21:49:26.035: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/api/Status: an exception occurred. 
05-25 21:49:26.036: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/common/data/DataBufferUtils: an exception occurred. 
05-25 21:49:26.036: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/Games: an exception occurred. 
05-25 21:49:26.036: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/Games$GamesOptions: an exception occurred. 
05-25 21:49:26.037: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/Games$GamesOptions$Builder: an exception occurred. 
05-25 21:49:26.037: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/Player: an exception occurred. 
05-25 21:49:26.038: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/PlayerBuffer: an exception occurred. 
05-25 21:49:26.038: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/PlayerLevel: an exception occurred. 
05-25 21:49:26.039: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/PlayerLevelInfo: an exception occurred. 
05-25 21:49:26.040: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/Players: an exception occurred. 
05-25 21:49:26.040: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/Players$LoadPlayersResult: an exception occurred. 
05-25 21:49:26.041: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/achievement/Achievement: an exception occurred. 
05-25 21:49:26.041: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/achievement/Achievements$LoadAchievementsResult: an exception occurred. 
05-25 21:49:26.042: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/event/Event: an exception occurred. 
05-25 21:49:26.042: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/event/EventBuffer: an exception occurred. 
05-25 21:49:26.043: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/event/Events: an exception occurred. 
05-25 21:49:26.043: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/event/Events$LoadEventsResult: an exception occurred. 
05-25 21:49:26.043: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/achievement/AchievementBuffer: an exception occurred. 
05-25 21:49:26.044: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/achievement/Achievements: an exception occurred. 
05-25 21:49:26.044: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/leaderboard/Leaderboard: an exception occurred. 
05-25 21:49:26.045: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/leaderboard/LeaderboardBuffer: an exception occurred. 
05-25 21:49:26.045: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/leaderboard/Leaderboards: an exception occurred. 
05-25 21:49:26.045: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/leaderboard/LeaderboardScore: an exception occurred. 
05-25 21:49:26.046: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/leaderboard/LeaderboardScoreBuffer: an exception occurred. 
05-25 21:49:26.046: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/leaderboard/LeaderboardVariant: an exception occurred. 
05-25 21:49:26.047: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/leaderboard/Leaderboards$LeaderboardMetadataResult: an exception occurred. 
05-25 21:49:26.047: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/leaderboard/Leaderboards$LoadScoresResult: an exception occurred. 
05-25 21:49:26.048: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/Invitation: an exception occurred. 
05-25 21:49:26.048: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/InvitationBuffer: an exception occurred. 
05-25 21:49:26.051: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/Invitations: an exception occurred. 
05-25 21:49:26.052: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/Invitations$LoadInvitationsResult: an exception occurred. 
05-25 21:49:26.053: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/Multiplayer: an exception occurred. 
05-25 21:49:26.053: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/Participant: an exception occurred. 
05-25 21:49:26.054: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/ParticipantResult: an exception occurred. 
05-25 21:49:26.055: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/LoadMatchesResponse: an exception occurred. 
05-25 21:49:26.055: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMatch: an exception occurred. 
05-25 21:49:26.056: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMatchBuffer: an exception occurred. 
05-25 21:49:26.057: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMatchConfig: an exception occurred. 
05-25 21:49:26.057: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMatchConfig$Builder: an exception occurred. 
05-25 21:49:26.058: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer: an exception occurred. 
05-25 21:49:26.059: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$CancelMatchResult: an exception occurred. 
05-25 21:49:26.059: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$InitiateMatchResult: an exception occurred. 
05-25 21:49:26.060: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$LeaveMatchResult: an exception occurred. 
05-25 21:49:26.060: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$LoadMatchesResult: an exception occurred. 
05-25 21:49:26.061: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$LoadMatchResult: an exception occurred. 
05-25 21:49:26.061: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$UpdateMatchResult: an exception occurred. 
05-25 21:49:26.061: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/quest/Quest: an exception occurred. 
05-25 21:49:26.062: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/quest/QuestBuffer: an exception occurred. 
05-25 21:49:26.062: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/quest/Quests: an exception occurred. 
05-25 21:49:26.062: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/quest/Milestone: an exception occurred. 
05-25 21:49:26.063: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/quest/Quests$LoadQuestsResult: an exception occurred. 
05-25 21:49:26.063: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/quest/Quests$AcceptQuestResult: an exception occurred. 
05-25 21:49:26.064: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/quest/Quests$ClaimMilestoneResult: an exception occurred. 
05-25 21:49:26.064: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/snapshot/Snapshot: an exception occurred. 
05-25 21:49:26.065: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/snapshot/SnapshotContents: an exception occurred. 
05-25 21:49:26.065: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/snapshot/SnapshotMetadata: an exception occurred. 
05-25 21:49:26.065: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/snapshot/SnapshotMetadataBuffer: an exception occurred. 
05-25 21:49:26.066: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/snapshot/Snapshots: an exception occurred. 
05-25 21:49:26.068: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/snapshot/Snapshots$CommitSnapshotResult: an exception occurred. 
05-25 21:49:26.069: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/snapshot/Snapshots$LoadSnapshotsResult: an exception occurred. 
05-25 21:49:26.070: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/snapshot/Snapshots$OpenSnapshotResult: an exception occurred. 
05-25 21:49:26.070: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/snapshot/SnapshotMetadataChange: an exception occurred. 
05-25 21:49:26.071: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/snapshot/SnapshotMetadataChange$Builder: an exception occurred. 
05-25 21:49:26.071: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/realtime/RealTimeMessageReceivedListener: an exception occurred. 
05-25 21:49:26.072: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/realtime/RealTimeMultiplayer: an exception occurred. 
05-25 21:49:26.073: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/realtime/RealTimeMessage: an exception occurred. 
05-25 21:49:26.074: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/realtime/Room: an exception occurred. 
05-25 21:49:26.074: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/realtime/RoomConfig: an exception occurred. 
05-25 21:49:26.075: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/games/multiplayer/realtime/RoomConfig$Builder: an exception occurred. 
05-25 21:49:26.076: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/appstate/AppStateManager: an exception occurred. 
05-25 21:49:26.077: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/nearby/Nearby: an exception occurred. 
05-25 21:49:26.077: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/nearby/connection/AppIdentifier: an exception occurred. 
05-25 21:49:26.078: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/nearby/connection/AppMetadata: an exception occurred. 
05-25 21:49:26.078: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/nearby/connection/Connections: an exception occurred. 
05-25 21:49:26.079: E/GamesNativeSDK(18597): Can't register class com/google/android/gms/nearby/connection/Connections$StartAdvertisingResult: an exception occurred. 

谷歌搜索的問題沒有取得什麼結果。似乎有一個similar issue with the Unity pluginthis blog isn't helping much

爲什麼會發生此錯誤?有人遇到過這種情況麼?

回答

2

這些錯誤是由不屬於您的應用程序的google-play-services jar文件引起的。這些步驟佈局上https://developers.google.com/games/services/cpp/gettingStartedAndroid 檢查事項:

  1. 您項目包括谷歌,播放services.jar和Android的支持 - v4.jar文件(它們被包含在APK文件)。
  2. 它是庫的最新版本(至少22版,但最新版是首選)。您可以使用SDK管理器下載最新版本。
+0

您鏈接的說明不提任何jar文件。 C++ SDK不包含任何jar文件。他們真的需要嗎?我會盡力讓他們看看會發生什麼。 – Lof

+0

我使用Android SDK Manager下載了Google Play服務,並將其複製到我的Android項目的libs文件夾中。這解決了init的問題。謝謝。 – Lof

+0

其實,你不應該把google-play-services.jar放到你的項目中。您應鏈接到庫,如下所述:https://developer.android.com/tools/projects/projects-cmdline.html#ReferencingLibraryProject – Lof

0

萬一有人遇到這個問題,但沒有解決問題了,這裏是我如何固定我的:我改變我的Proguard的配置,因此不會從com.google.android包裝帶任何類。

即: 從-keep public class com.google.android.gms.* { public *; }-keep public class com.google.android.gms.** { public *; }


您可能還需要激活multiDex在build.gradle文件,下面幾行: buildTypes { yourBuildType_Eg_release { multiDexEnabled true dexOptions { preDexLibraries false incremental true // that's a big heap! javaMaxHeapSize "4g" } } }

相關問題