Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Resolved Error connecting to Google Play Services

Discussion in 'Scripting' started by LexVolkov, Nov 7, 2021.

  1. LexVolkov

    LexVolkov

    Joined:
    Sep 14, 2014
    Posts:
    62
    Hi.
    Help me to understand.
    When I build in a "Development mode" everything works. But In this mode, i cannot sign a build (what need to download in Google Play Console). But, if unchecked "Development mode" , then an error will appear in the Logcat when i try to call authenticate (Social.localUser.Authenticate).

    2021.11.07 21:15:07.692 21846 21870 Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.Games
    2021.11.07 21:15:07.692 21846 21870 Error Unity java.lang.ClassNotFoundException: com.google.android.gms.games.Games
    2021.11.07 21:15:07.692 21846 21870 Error Unity at java.lang.Class.classForName(Native Method)
    2021.11.07 21:15:07.692 21846 21870 Error Unity at java.lang.Class.forName(Class.java:454)
    2021.11.07 21:15:07.692 21846 21870 Error Unity at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    2021.11.07 21:15:07.692 21846 21870 Error Unity at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
    2021.11.07 21:15:07.692 21846 21870 Error Unity at com.unity3d.player.UnityPlayer$e.handleMessage(Unknown Source:95)
    2021.11.07 21:15:07.692 21846 21870 Error Unity at android.os.Handler.dispatchMessage(Handler.java:103)
    2021.11.07 21:15:07.692 21846 21870 Error Unity at android.os.Looper.loop(Looper.java:224)
    2021.11.07 21:15:07.692 21846 21870 Error Unity at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
    2021.11.07 21:15:07.692 21846 21870 Error Unity Caused by: java.lang.ClassNotFoundException: com.google.android.gms.games.Games
    2021.11.07 21:15:07.692 21846 21870 Error Unity ... 8 more
    2021.11.07 21:15:07.692 21846 21870 Error Unity at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
    2021.11.07 21:15:07.692 21846 21870 Error Unity at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
    2021.11.07 21:15:07.692 21846 21870 Error Unity at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <000000000000


    Im using:
    Windows 10
    Unity 2020.2.22f1 (LTS)
    GooglePlayGamesPlugin-0.10.12
    In scene, only this example: https://github.com/playgameservices/play-games-plugin-for-unity/tree/master/samples/Minimal
    In Unity:
    SDK,NDK,JDK are connected and working properly.
    SignKey Installed
    "Minify" -> "Release" cheked
    "IL2CCP" selected
    "ARMv7" and "ARM64" checked
    "Android setup" filled
    "Force Resolved" did
    In Google:
    SHA1 Upload matches with Google Cloud Platform
    Google Play Sevirce Credentials is configured and Publish.

    I don't know what could be wrong. I can't find any answer for a week. but nothing helps.
    Dont works with Upload key in local test and dont works with App key in Google test.
    Please tell me where to look for the problem.
     
  2. LexVolkov

    LexVolkov

    Joined:
    Sep 14, 2014
    Posts:
    62
    found a solution. maybe someone will need: https://www.higithub.com/playgameservices/issue/play-games-plugin-for-unity/3072

    just check the box "Custom Proguard File" and paste this into the proguard file:

    Code (CSharp):
    1. -keep class com.google.android.gms.games.leaderboard.** { *; }
    2. -keep class com.google.android.gms.games.snapshot.** { *; }
    3. -keep class com.google.android.gms.games.achievement.** { *; }
    4. -keep class com.google.android.gms.games.event.** { *; }
    5. -keep class com.google.android.gms.games.stats.** { *; }
    6. -keep class com.google.android.gms.games.video.** { *; }
    7. -keep class com.google.android.gms.games.* { *; }
    8. -keep class com.google.android.gms.common.api.ResultCallback { *; }
    9. -keep class com.google.android.gms.signin.** { *; }
    10. -keep class com.google.android.gms.dynamic.** { *; }
    11. -keep class com.google.android.gms.dynamite.** { *; }
    12. -keep class com.google.android.gms.tasks.** { *; }
    13. -keep class com.google.android.gms.security.** { *; }
    14. -keep class com.google.android.gms.base.** { *; }
    15. -keep class com.google.android.gms.actions.** { *; }
    16. -keep class com.google.games.bridge.** { *; }
    17. -keep class com.google.android.gms.common.ConnectionResult { *; }
    18. -keep class com.google.android.gms.common.GooglePlayServicesUtil { *; }
    19. -keep class com.google.android.gms.common.api.** { *; }
    20. -keep class com.google.android.gms.common.data.DataBufferUtils { *; }
    21. -keep class com.google.android.gms.games.quest.** { *; }
    22. -keep class com.google.android.gms.nearby.** { *; }
    23. -keep class com.google.android.gms.games.Games.** { *; }
    24. -keep class com.google.android.gms.games.multiplayer.** { *; }
    25. -keep class com.unity.androidnotifications.* { *; }