Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Google Play Services not working?

Discussion in 'Android' started by SD2020_, Jul 26, 2017.

  1. SD2020_

    SD2020_

    Joined:
    Nov 3, 2015
    Posts:
    107
    I have google play services setup in my dev console and inside my game. When I call the login on start up it shows the Google Play loging screen then closes after trying to connect as in it fails to connect? Is there a reason for this?

    I have internet and I have google play services on my phone but it doesnt seem to want to work for me..

    Can someone that is really good with setting up play services contact me?
     
    HanSoloYolo likes this.
  2. HanSoloYolo

    HanSoloYolo

    Joined:
    May 22, 2017
    Posts:
    19
    I'm having the exact same issue.

    It connects and works fine in the Unity Build, but for some reason the version you download from the Play Store doesn't work. It opens the authentication window then just auto-closes before you can select an account to login to.

    I've tried everything. All my SHA1's match. Again, it even works after I build the APK with Unity and install on my phone. But after I upload the APK to the store and download it or download the derived version, it stops working.

    Someone please help!
     
    Mhietos likes this.
  3. HanSoloYolo

    HanSoloYolo

    Joined:
    May 22, 2017
    Posts:
    19
  4. HanSoloYolo

    HanSoloYolo

    Joined:
    May 22, 2017
    Posts:
    19
    TESTED & SOLVED

    OK. So, This is how you fix it. When you uploaded your APK you used your SHA1 for the Uploaded Version. Google gives you a different SHA1 AFTER YOU UPLOAD YOUR APK (those bastards).

    You need to input this NEW SHA1 into your Credentials. Follow these steps:


    1. Go to Google Developer Console
    2. Click All Applications > Your Application
    3. Go to Release Management > App Signing
    4. Notice there is an "Upload Certificate" and an "App Signing Certificate".
    5. Copy the SHA1 from the APP SIGNING CERTIFICATE. (Those bastards! After all that keystore rigmorale, they fail to mention this part in documentation!)
    6. Click All Applications on the Top Left, then click Game Services > Game Details
    7. Scroll all the way down and look for
      API Console project
      This game is linked to the API console project called 'YOUR APPLICATION NAME SHOULD BE HERE'
    8. Click on your application name at this location.
    9. Now you're in the API's & services. Click on Credentials
    10. Delete whatever you have under
      OAuth 2.0 client IDs
    11. Now, click on Create Credentials > OAuth Client ID
    12. COPY THE SHA1 FROM THE APP SIGNING CERTIFICATE HERE AND BE SURE YOUR PACKAGE NAME IS CORRECT.



    EVERYTHING SHOULD WORK NOW, AFTER GIVING IT A COUPLE MINUTES TO UPDATE. I HATE THAT THIS IS NOT DOCUMENTED CLEARLY.
     
  5. kesada7

    kesada7

    Joined:
    Jun 21, 2017
    Posts:
    11
    I am sorry for the ridiculously brief solution, I was dealing over one week just to implement Google Play Services and that problem gave me struggles for tons of hours... It doesn´t make any sense and in the documentation there was no clear information about that. At the end of hours of research, I found the solution that I said, it was a problem that Google changed the apk that you uploaded for another signed with another SHA1 code. I'm sorry I did not put a list step by step like you but I think I put you on the correct path to the solution after all. Thanks for sharing so detailed instructions.

    Regards.
     
    EyeUnitedEmCee likes this.
  6. Gurosoft

    Gurosoft

    Joined:
    Sep 14, 2017
    Posts:
    7
    The step 11:
    After I have to choose Android Application maybe?
    And write the same name as my APP
    And the same package?
    But still not work for me :(
     
  7. RedHillbilly

    RedHillbilly

    Joined:
    Mar 24, 2014
    Posts:
    28
    EDIT/WARNING:
    Do not delete the OAuth 2.0 client ID it will create a new client ID and you won't be able to use the google play api anymore, as the linked app has an other client ID. Instead edit the one there.

    Thanks, worked perfectly!

    write the exact same infos you find under "Linked Apps" in the Game services console, should work
     
    Last edited: Nov 15, 2017
  8. garimrj

    garimrj

    Joined:
    Jul 31, 2017
    Posts:
    1
    I deleted the OAuth 2.0 client ID. How can I remove the linked app and add another one since the ID Autho2 is not valid anymore ?
     
  9. bradp904

    bradp904

    Joined:
    Nov 21, 2017
    Posts:
    2
    First of all, you need to delete Google Play Store related data. Just head over to Settings > App Manager and then tap on Clear Data. OR Reset your Google account and add a new one. If it still not working. You should check out this solution to fix the issue.
     
  10. domdev

    domdev

    Joined:
    Feb 2, 2015
    Posts:
    360
    my App signing certificate did not change after I upload new apk.. not sure why.. I also did everything but still not working.. any?
     
  11. unity_7rds8977

    unity_7rds8977

    Joined:
    Jun 6, 2018
    Posts:
    1
    can someone really help me because my google play services is not showing anything .
     
  12. mliukka

    mliukka

    Joined:
    Nov 1, 2015
    Posts:
    19
    If you've followed through the usual solutions (checking the SHA1 keys), and still can't get the login to finish (the green Google Play screen shows, but the "Welcome" screen doesn't), there's one more thing worth trying. In case you're using two different Google accounts to develop and to test the game on your phone, you need to manually add your gmail as a tester. I have a personal gmail I'm using on my phone and a DIFFERENT gmail to log on my developer account, so for that simple reason couldn't get the authentication to finish on my phone. Your developer account is added as a tester automatically but any additional testers have to be added manually. This could be the reason why for some people it never works during testing but does work after publishing.

    http://answers.unity.com/answers/1532378/view.html
     
    tarnumius likes this.
  13. OrajokNor

    OrajokNor

    Joined:
    Oct 1, 2015
    Posts:
    2
    Thanks a lot man. It works.
     
  14. Shayke

    Shayke

    Joined:
    Dec 8, 2017
    Posts:
    352
    Guys i just wanted to say that i love you!!!!
     
  15. GnRDevAnd

    GnRDevAnd

    Joined:
    Oct 18, 2018
    Posts:
    2
    God Bless you man!


     
  16. Sw_Architect

    Sw_Architect

    Joined:
    Jul 3, 2016
    Posts:
    3
    I have google play services setup in my developer console and inside my game. When I call the login on start up it dosnt shows the Google Play login screen ?
     
  17. unity_1cewWbGw8rRVxw

    unity_1cewWbGw8rRVxw

    Joined:
    Jun 6, 2018
    Posts:
    7
    ok Guys i am facing a wired issue.
    I can test the build after downloading from google play(Beta Version) but not when i directly build from Unity.
    In Case of Unity Play Game Popup Appears and then in did not login in and Disappears
     
  18. CrizGames

    CrizGames

    Joined:
    Dec 4, 2016
    Posts:
    1
    Same
     
  19. andashevdeveloper

    andashevdeveloper

    Joined:
    Dec 31, 2018
    Posts:
    1
    Thank you man!!!! You saved my life!
     
  20. Channabasappa

    Channabasappa

    Joined:
    Jan 29, 2017
    Posts:
    2
    Thank you very much. Worked perfectly
     
  21. Zankomag

    Zankomag

    Joined:
    Apr 29, 2018
    Posts:
    1
    GOD I love you!
     
  22. Bestusefultips

    Bestusefultips

    Joined:
    Jun 24, 2019
    Posts:
    1
    Annoying of Google play services keeps stopping working message in your android phone? When use outdated version of Google Play services, you can show Google Play services has stopped working message consistent popping up with error. Try below given two methods to fix this issues.

    1st Method: Make sure use latest updated version of Google Play services

    Play store > Three horizontal lines > My apps & games > Update all

    If updated with latest version, uninstall app update in your android device and update again using below given settings.

    Settings > Apps > Google play services > More > Uninstall updates

    Now restart your android device and update with latest version and check fix issue.

    2nd Method: Clear the cache of Google Play Services

    Settings > Apps > Google Play Services > Storage > Clear cache

    I hope one of the above given method useful to fix Google play service issue.
     
  23. berkeozkir

    berkeozkir

    Joined:
    Jan 13, 2018
    Posts:
    1
    YOU ARE THE BEST!!
     
  24. bruinsee

    bruinsee

    Joined:
    Nov 9, 2016
    Posts:
    2
    Another thing to note, is that if you have google signing your apps on their side, you will need to add the SHA1 key for your local keystore too into the API Console
     
  25. bug5532

    bug5532

    Joined:
    Aug 16, 2011
    Posts:
    307
    I'm getting this error when I follow these instructions:
    Duplicate fingerprint
    The fingerprint you specified is already used by an Android OAuth2 client ID in this project or another project

    any ideas?



     
  26. ferranases

    ferranases

    Joined:
    Feb 27, 2017
    Posts:
    8
    Same error here
    When I select the mail in the window of google play it don't login and hidde the window.
    I try it all: delete OAUTH2, put the "Upload Certificate",etc...

    Unity 2019.2.4 + GooglePlayGames 0.9.64

    Any solution?
     
    Last edited: Oct 11, 2019
  27. ferranases

    ferranases

    Joined:
    Feb 27, 2017
    Posts:
    8
    I find a solution from my login fail:
    In linked aplications, put you application twice,one with the sha1 debug and the other with the upload sha1
    So when you make tests with your phone you can login cause is not in production mode.
     
  28. Nikolat93

    Nikolat93

    Joined:
    Sep 5, 2016
    Posts:
    23
    Thank you for you clear answer. I don't understand why Google makes it so complicated
     
  29. Thanatos_Psychopomp

    Thanatos_Psychopomp

    Joined:
    Mar 16, 2018
    Posts:
    8
    Just wanted to add that this saved my day. I did not delete the old OAuth 2 ID, but instead created one with the same name and coppied the key as instructed. Worked within a minute.
     
  30. Zarkend

    Zarkend

    Joined:
    May 11, 2016
    Posts:
    19
    Just to let you know, you saved my day too! kudos ;)
     
  31. KSF

    KSF

    Joined:
    Mar 15, 2015
    Posts:
    4
    DO NOT delete OAuth key!!! Only edit it!!! New OAuth keys won't work with your project.
    If you delete you need to RECREATE Google Play Service project.
     
    gsorin likes this.
  32. dcolman

    dcolman

    Joined:
    May 21, 2017
    Posts:
    8
    Thank you! I actually had the SHA1 key for the application in the API Console already but was missing the local keystore SHA1 key. Appreciate you chiming in.
     
  33. Baalhug

    Baalhug

    Joined:
    Aug 12, 2013
    Posts:
    32
    You should be banned from the forum for posting this "solution" so freely. Any developer who has other apps using an OAuth 2.0 client will lose all authentication functionality on their apps after they do the 10th step of your guide. Before calling Google devs "Bastards", as you did, be sure you're not a moron. You only have to edit the SHA1.
     
    JACLEMGO likes this.
  34. FaisalNaseer2k4

    FaisalNaseer2k4

    Joined:
    Aug 22, 2019
    Posts:
    8
    after step 11
    After Step 11 my app was still having issues .. I searched more and found that on creating new OAuth credentials my client id was different than the one in the linked app... now I see that may be the issue so looking further to change it in GameServices.. Any Idea how to do that or I have to recreate game services or something else?
     
  35. JACLEMGO

    JACLEMGO

    Joined:
    May 30, 2013
    Posts:
    27

    This "solution" will only work with your debug build, not the production build.

    Correct solution for debug and production is to link multiple apps in the "Link Apps" section in Game Services, one for the App Signing Certificate SHA1 and another using the Upload Certificate SHA1, like @ferranases mentioned.
     
    yurapetrosyan93 likes this.
  36. Pavlos_Mavris

    Pavlos_Mavris

    Joined:
    Sep 17, 2018
    Posts:
    50
    How can I do that with a correct way, because I try to recreate it but is says that I have already an app with the same package and SHA1
     
  37. yurapetrosyan93

    yurapetrosyan93

    Joined:
    Nov 11, 2017
    Posts:
    1
    Hey man, you really helped me thank you bro!
     
  38. Geri860

    Geri860

    Joined:
    Aug 25, 2018
    Posts:
    5
    Hey same here. I've deleted it.... have you figured it out?
     
  39. Geri860

    Geri860

    Joined:
    Aug 25, 2018
    Posts:
    5
    Hi there.. So am I fcked? What should I do then?
     
  40. Pavlos_Mavris

    Pavlos_Mavris

    Joined:
    Sep 17, 2018
    Posts:
    50
    I deleted the whole service and I create it again from scratch and it worked
     
  41. vasanthbalaji

    vasanthbalaji

    Joined:
    Nov 15, 2014
    Posts:
    34
    it is happening because we should add app signing certificate sha1 cerficate fingerprint in gameservices linked apps,(if you are using google app signing key)
    The app which you linked had keystore sha1 signing fingerprint, i too had same problem , i just linked same app another time with googles app signing key sha1 and removed the previous linked app and it started working.
    P.S.
    Please Check the second time linked app with your app ,if its working then delete the previous linked app from Gameservices.
     
  42. Ricky-Brno

    Ricky-Brno

    Joined:
    Sep 16, 2018
    Posts:
    2
    This works flawlessly! I love you, man! You saved my hair, because I was tearing them off already... even though phone logs was suggesting this could be wrong certificate, I still was even thinking there could be just some other certificate it's checking... how could this just not use single certificate identity for everything by default
    Thanks a bunch for posting this
     
  43. tarnumius

    tarnumius

    Joined:
    Feb 16, 2018
    Posts:
    5
    Thank you. You save my day.
     
  44. vishalcruze29

    vishalcruze29

    Joined:
    Sep 10, 2020
    Posts:
    2
    You are a Life Saver Mate .... Thank You ...<3
     
  45. mckinney777me

    mckinney777me

    Joined:
    Oct 2, 2020
    Posts:
    2
    I finally found a fix for mine after forever and nothing working.

    So in you google API credentials, change your SHA1 to the SHA1 your app is using.

    I found this by plugging in my device in android studio, and using logcat to view logs while running. It said to make sure SHA1 matches in your Google API. It also gives you the current SHA1. After copying the SHA1 your app signs with, and pasting into Google API credentials, same place earlier comment said. Worked instantly for me. Had to figure this out all alone, no one said it anywhere.
     
  46. idris2573

    idris2573

    Joined:
    Sep 28, 2019
    Posts:
    1
    Thank you guys soo much. I've been stuck on this issue for hours.

    If you are trying to test google play services via unity build and run, you will need to have 2 linked accounts and
    OAuth 2.0 Client IDs: 1 with the google provided SHA1 and one with the publish SHA1 (based off your own keystore)
     
  47. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,029
    Taken from Cross Platform Native Plugins 2.0 : Essential Kit
    But, the info here is very general and works with any plugins. You need to have a clear understanding on why this issue happens. Read below on how to solve this.

    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.
     
    Last edited: Apr 27, 2021
    cyberbloody, egor_shem and D00MX like this.
  48. ShaggyShiva

    ShaggyShiva

    Joined:
    May 21, 2017
    Posts:
    1

    Worked Perfectly! Thanks lifesaver (y)
     
  49. sadeghpoor

    sadeghpoor

    Joined:
    Sep 1, 2015
    Posts:
    6

    thanks alot
     
  50. concubicycle

    concubicycle

    Joined:
    Jan 18, 2015
    Posts:
    4
    Did the developer console change? I can't seem to find the Release Management section now.

    Ah, it's in the Setup->Internal app sharing. I can't seem to get the certificate to appear there, even when I upload my app.

    I get the feeling this process is deliberately excruciating.
     
    Last edited: Apr 30, 2021
unityunity