Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Initialization of GPGS 21 fails with Can't register class com/google/android/gms/games/multiplayer/*: an exception occurred. #67

Open
solodon4 opened this issue Sep 16, 2021 · 0 comments

Comments

@solodon4
Copy link

When I am using the latest implementation com.google.android.gms:play-services-games:21.0.0 I get the following errors when trying to create gpg::GameServices object:

E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/Invitation: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/InvitationBuffer: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/Invitations: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/Invitations$LoadInvitationsResult: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/Multiplayer: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/Participant: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/ParticipantResult: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/LoadMatchesResponse: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMatch: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMatchBuffer: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMatchConfig: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMatchConfig$Builder: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$CancelMatchResult: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$InitiateMatchResult: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$LeaveMatchResult: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$LoadMatchesResult: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$LoadMatchResult: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/turnbased/TurnBasedMultiplayer$UpdateMatchResult: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/realtime/RealTimeMessageReceivedListener: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/realtime/RealTimeMultiplayer: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/realtime/RealTimeMessage: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/realtime/Room: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/realtime/RoomConfig: an exception occurred.
E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/realtime/RoomConfig$Builder: an exception occurred.
E/GamesNativeSDK: Could not register one or more required Java classes.

I am fully aware that Google has ended support for multiplayer APIs on March 31, 2020 and it seems that version 21 of play games services is the first version in which that functionality has actually been removed, which would explain why initialization fails. However, my app does not use any multiplayer APIs, so the problem is entirely on Google's side, possibly in one of the dependencies trying to access those APIs.

Here is a full list of my dependencies for reference:

    // Google Play Services
    implementation 'com.google.android.gms:play-services-auth:19.2.0'
    implementation 'com.google.android.gms:play-services-base:17.6.0'
    implementation 'com.google.android.gms:play-services-games:20.0.0'
    implementation 'com.google.android.gms:play-services-nearby:18.0.0'

    // From: https://firebase.google.com/docs/auth/cpp/play-games#ndk-build
    implementation(name:'google-signin-cpp-release', ext:'aar')

    // Chartboost: https://answers.chartboost.com/en-us/child_article/android-integration
    implementation 'com.chartboost:chartboost-sdk:8.2.0'

    // AdMob Mediation
    // See: https://github.com/firebase/firebase-cpp-sdk/issues/621
    implementation 'com.google.ads.mediation:adcolony:4.4.1.0'
    implementation 'com.google.ads.mediation:chartboost:8.2.0.0'

    // Mediation Test Suite
    // See: https://github.com/firebase/firebase-cpp-sdk/issues/621
    implementation 'com.google.android.ads:mediation-test-suite:1.5.0'

    // Firebase
    implementation 'com.google.firebase:firebase-analytics:19.0.0'
    implementation 'com.google.firebase:firebase-ads:19.8.0'
    implementation 'com.google.firebase:firebase-auth:21.0.1'
    implementation 'com.google.firebase:firebase-dynamic-links:20.1.1'
    implementation 'com.google.firebase:firebase-config:21.0.0'
    implementation 'com.google.firebase:firebase-crashlytics-ndk:18.2.0'
    implementation 'com.google.firebase:firebase-perf:20.0.2'
    implementation 'com.google.firebase:firebase-storage:20.0.0'

After weeks of trying various combinations fo versions I came up with the following workaround: if I downgrade version to com.google.android.gms:play-services-games:20.0.0, which is the latest version where those classes were still present, as well as include an additional package not mentioned in the documentation as relevant to anything I do: com.google.android.gms:play-services-nearby:18.0.0 I end up not getting any E/GamesNativeSDK: Can't register class com/google/android/gms/games/multiplayer/xxxxxx: an exception occurred. errors and am able to successfully create gpg::GameServices object.

Again, I don’t use any of the multiplayer functionality or nearby discovery so I guess one of your dependencies either in GPGS or in Firebase must be causing the problem.

P.S. Versions not mentioned above:

  • Google Play Games C++ SDK Version: 3.1.0
  • Firebase C++ SDK version: 8.3.0
  • Host: macOS
  • Target: Android
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant