Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Google Play Services working on build from computer, not when downloaded from Play Store

Discussion in 'Android' started by James15478, Oct 28, 2020.

  1. James15478

    James15478

    Joined:
    Apr 2, 2013
    Posts:
    91
    I set up Google Play Services and it works when I build directly from the Unity editor onto the device.

    However after upload to the Play Store for testing (on an internal test track) it doesn't work, even for the same account which works on the direct-from-Unity-editor build. I added all the accounts as testers to both GPG and as internal testers in the Google Play Console (the authentication error I get is "Authentication canceled", which it definitely isn't). I'm only trying to authenticate the user. Has anyone experienced this? Im trying to figure out why authentication works when I build directly to the device and why it doesn't when I download from the store (even as a tester). Any help would be appreciated, thanks!
     
  2. xellso

    xellso

    Joined:
    Jul 31, 2018
    Posts:
    2
    Do you use Google signing? If yes the uploaded apk to google play will have a different SHA1 key than your build signed by unity. That was the problem in my case.
     
  3. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    Also adb logcat might give you some additional information
     
  4. ruimcp95

    ruimcp95

    Joined:
    Mar 19, 2019
    Posts:
    5
    And how to fix that? I already signed the game with the SHa1 key google gave me. Still no response from google play services when I boot the game.
     
  5. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,952
    Why sign in fails?
    For Google Play Services to sign in successfully, you need to make sure the apk from where you are logging in should be allowed to make requests to google servers.

    How to make the APK authorized to make requests to google servers?
    Each apk built with a keystore has a SHA fingerprint. You need to make sure the SHA fingerprint is added in the google cloud.

    You can fetch it with keytool command (check here on how to get SHA for each environment )

    How many SHA fingerprints I need to add for successful authentication?
    In Unity,

    1. Development build uses android default debug keystore.

    2. Release build uses the keystore you set in publishing settings of player settings

    3. Google play store build which uses google play signing.

    So in total 3 environments (dev, release and production). If you want all the above builds to authenticate successfully, add all 3 fingerprints.

    How to get each environment's SHA?
    1. Debug ( keytool -list -v -keystore "PATH_TO_DEBUG_KEYSTORE" -alias androiddebugkey -storepass android -keypass android)

    2. Release (Get from Google play console -> Your App -> Setup -> App signing -> Upload key certificate )

    3. Apk/AAb downloaded from Google play store (Get from Google play console -> Your App -> Setup -> App signing -> App signing key certificate )

    Where to add these SHA fingerprints?
    Google Play Console. Check here for details on how to add a SHA fingerprint.

    Taken from CrossPlatformNativePlugins 2.0 : Essential Kit
     
  6. evertmlls

    evertmlls

    Joined:
    Jan 12, 2021
    Posts:
    1
    Thanks guys
     
  7. inchgames

    inchgames

    Joined:
    Jul 8, 2018
    Posts:
    7

    Any ideas why after checking development build in Unity 2020.3 using this command
    keytool -printcert -jarfile FileName.aab
    it says "Not a signed jar file"
    When I try this build on phone it says
    PlayGamesServices[PlayerAgent]: Unable to load player a_7317956423373006213

    03-22 00:31:23.345 4461 26348 W PlayerAgent: {"code":400,"errors":[{"reason":"invalid","domain":"global","message":"Invalid applicationId with value . Reason: No application ids specified."}]}