playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.44k stars 959 forks source link

Authentication only happens when it's a Development Build #3020

Closed serge144 closed 3 years ago

serge144 commented 3 years ago

This is strange, I have been testing my game locally (and thus I use the Upload key certificate and not the App signing key certificate as shown in Play Console). Everything was working fine. I succesfully authenthicate the user and could access and show the leaderboards without any issue. Recently, I wanted to publish my game to an Internal Testing track, therefore, I simply went on to my game's Play Services configuration, and on the Google Cloud Platform I switched the SHA-1 certificate fingerprint to now match the App signing key certificate and not the Upload key certificate (Play Console -> Release -> Setup -> App Integrity). After published to the Internal Track, I see it's not authenticating at all. So i take a step back, and switch the SHA-1 certificate back to the Upload key certificate to test locally, but not authenticating aswell again. I then ran a Development Build to see what was going on in the debug messages, and guess what, it is working lol... I've tested multiple times and only working on development build... So there's no way of me knowing what is going on...

The only changes i've made: -> As described, only changed the SHA-1 certificate fingerprint in Google Cloud Platform -> Been clearing the cache and data of Play Store app

Why on earth would this only work in a Development Build?

How can i fix this?

Thank you in advance.

serge144 commented 3 years ago

Found the issue.

Firstly, here's what I did to debug my game: I basically used a simple script, that displays console errors into a text area in-game, here's the script: https://answers.unity.com/questions/125049/is-there-any-way-to-view-the-console-in-a-build.html

Then in the text area in-game, I saw that I was getting an error -> AndroidJavaException: Java.lang.ClassNotFoundException: Didn't find class "com/google/android/gms/games/Games" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar" (...)

This immeadiatly made me think it was a proguard problem. So I followed this thread: https://github.com/playgameservices/play-games-plugin-for-unity/issues/2796 ( see the answer of Dongurea )

Cheers.