-
Notifications
You must be signed in to change notification settings - Fork 49
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
[Android] signIn() returns null #129
Comments
Try creating a string resource for your app id and use it in AndroidManifest.
|
Changed to:
Created file (\android\app\src\main\res\values\games-ids.xml):
Same result, |
Double check the credential setup process as it's almost certainly an issue with your app authorizing with Play Games. Are you using the Project ID that looks like a large number and the fingerprint for the debug key? The 4th item in that list will not be checked until you upload a build with Play Games Services and is not necessary to get the service working. If I recall, it can take up to 24 hours when play services is first setup. So if you are still in that window, that could be the case as well. |
Try the troubleshooting checklist provided here. |
That could be the problem. They are not very clear, but you can get all of this working without verification if you don't change certain aspects of the consent screen, such as the icon. However, once you change it or submit for verification, there is no undoing the need to verify. You may be able to select BACK TO TESTING in order to get it working on the debug app to confirm everything is setup correctly. |
I did that but I published it when checking before. So when I was getting the error, it was in testing already. More screens: |
any other idea @theLee3? |
I have tried with an old phone and I can see the popup: but it's not working as expected either way. Resuming:
For all on them, these 2 methods return null:
and again, for all of them, this function fails with this error:
The ID is correct: |
All of these symptoms point to the app not being configured properly for Play Games authorization. Anytime I've seen this, it's been because the signing config was off for the build. You have to ensure that if you are running a debug build, that it was signed with the debug key and the correct fingerprint is used. If you are running a release build, you need to ensure that the fingerprint coincides with the key that you signed your app with, or perhaps provided by the Play Store when using Google's app signing service. |
I'll delete it and start from scratch |
well, I can't remove anything, just edit it. If I go to This time, instead of copying it from the suggested data, I ran the keytool command: As you mentioned, both are different. So I used the last one, but when I try to create it, it fails: The previous one was removed as you can see here now: This was weird so I checked not just this project but all of them and found this: I had this one duplicated. Not sure when I created 2, maybe it was done by Firebase (I could see that it happend with another project that it was created twice). The thing is that I was using this fingerprint in the other one, so I removed it and also the project. Now I have created both: with the only different that the DEBUG can't be verified. In Google Play Services I have now 2 in the dropdown and 2 credentials created, one for each environment: From this point, having both fingerprints, I run this again:
I'll wait a few hours in case it's something related to that. UPDATE: after 6h I'm getting the same thing |
Having two GCP projects may be the culprit, and the next step I would suggest is going into Google Play Console for your game. Then under Play Games Services select Setup and management > Configuration, and at the very bottom Remove Play Games Services. I am not sure if Unpublish game project is necessary for this as well or not. If so though, it will not remove the actual app, just the game project. Then you can walk through setting up the game services in the Play Console again, including selecting the remaining GCP project and importing the credentials. |
That doesn't work as expected. First of all I unpublished it and then, removed it. Now, when I go to create a new one, I have 2 options:
I could try creating a new project in GPC |
That would be the next step. Great a new GCP project from the Play Store menu and setup the credentials again from there. Then update your app with the new credentials. |
Yeah, I was doing it in the meantime. Everything created and filled again, published, and app updated with new IDs. Result: Honestly I don't know what's going on and what else could I change/try. |
@theLee3 what is @erperejildo the screen capture you provided above here looks like a Play Games v1 sign-in dialog. Can you confirm whether you're using |
Hi @andynewman10 @erperejildo , |
@erperejildo |
I have the debug and release SHA1 fingerprints registered in the Cloud Console, as returned by Can you check
|
@Abedalkareem I do think something is printing |
Also ensure that the OAuth consent screen is available to external users or that all users attempting to sign in are added as testers on the GCP project. And double check all of this common issue points. |
I'm using
I added both, debug and release. I'd suggest adding this to the documention, just to avoid the case of copying the wrong one as I did in the first try (because Google Play Console pops up the release one as a recommendation and it might be confusing).
Ok. In my case,
not sure how to get that. Am I doing it correctly?
Didn't we mention that when click publish there is nothing we can change after that? It should be accesible while in testing as well, right? Checking that list, I also added the user I have in emulator/device to tests users: I tried after this but didn't do anything unfortunately. |
@erperejildo |
@erperejildo restart your machine, do a |
@theLee3 I confirm @erperejildo In the Play Console, in the Game Project settings, click the Examine and publish button in the top right corner. There is a Testers tab there. You need to add the email address of your Google Account there too. Adding an email address only in the OAuth part (Cloud Console) is not sufficient. Once you've done that, wait 10-20 minutes and try again. It should work. |
The sign-in dialog is the same between PGSv1/PGSv2 (games_services 3.0.3/4.0.0). I checked again and I was wrong, sorry about this. |
This took me a while so I'll go step by step. The game_services is version 4 as mentioned. This app is 2 weeks old and also the pubspec.lock is pointing to the same version. I upgraded Flutter yesterday and didn't compile after that. Trying now I saw that I was getting an issue. This was fixed by removing some file in /.gradle so it might be in conflicting with the key maybe? Now I tried again So I went here: https://maven.google.com/web/index.html?q=tools#com.android.tools.build:gradle and remove the 7.3.0 version and took the last one: 8.2.0 Now more things... when trying again to build it fails saying:
Weird thing because https://i.stack.imgur.com/85e6U.png but to make things more complicated I don't see this part: searching different places in Google I found this other one: This change "worked". At least, removed the previous error BUT added a new one (this doesn't end): Now here I'm confused. Definetely, settings.gradle is present (and open) in the root of the android folder. At this point I was totally tired so I decided to create a new project and copy lib, assets, etc. to it. But nah... the problem was still there. And this is where I am right now. Everything points to |
You mean here? I added it there also and waited 30 minutes. Nothing changed |
My bad everyone... @andynewman10, you are correct. |
The validation is now complete. I actually didn't have to do 'Back to testing', as suggested in the link I provided above. Instead, after a few hours, I was sent an email saying my website needed to comply with my branding, and other requests. I fullfilled the demands and everything went fine. The only hesitation I had was about the scopes: I only left the Somehow I haven't found much info about |
@andynewman10 I'm not sure about the differences between the 2 either. I wonder, with v2's seamless flow, if you need to declare any scopes there. It seems to be implied by the framework, and I tested briefly with no scopes and still had access to everything, including saved games. Point is, I think you'll be fine 👍 |
@theLee3 thank you! |
FTR @andynewman10, I have since confirmed that PGSv2's implementation does not negate the need for scope declarations in the GCP project. Login continued to work fine, but once propagated all other PGS functionality broke. |
@theLee3 thanks for the information.
Does this mean PGS automatically (kind of automagically) obtains the |
Here is all the relevant log (running an Internal Test build):
|
Note that I almost never look at the logcat, which I don't know how to consult in VS Code (?). I checked the above logcat with Android Studio. |
Yes, the v2 scopes are indeed added to the sign-in request by the PGS sign-in flow. Interesting though, is the lack of the While the scopes are attached to the sign-in request, they are not actually granted unless the GCP configuration matches. In your case, as you have declared the This also explains why sign in can be achieved with no scopes declared on GCP, but all other functionality fails. |
@theLee3 there is something going on after logging in with 2 users on one device. Since I did this on my phone, I'm unable to test anything else on this device. Right now, when I build, I don't see any user notification being logged in. but after this, I get
NOTE: on emulator it doesn't even show the login popup. I don't face the same issue, for example, on my wife's phone with her account, where I just test from the released version always (and never using my account). She only has her account there. On my phone, I have multiple accounts, including hers. All of them show up here (changing to another one doesn't work): And of course, I didn't change any configuration anywhere. This was (and it "is") working fine, the only problem wast that, linking my 2 accounts. Edit: What I did:
I remember doing this before, and after all of that, I got a warning saying I had to install/update Google Play Games from the store. I am not sure if this is a regression or not. So I installed it manually and continued the test with this installed... ...but nothing happens. So I decided to use my wife's phone to test and this time I got exactly the same behaviour; it doesn't show anything. In resume, only my phone is showing the popup, rest of the devices (reals or emulators), don't, but in any of them, I can log in. |
@erperejildo please confirm that you can login to other games on the devices. If possible, confirm that switching between multiple accounts work as well. |
I'm not sure that GPG login would fail due to billing not being enabled, but I suppose it could break the whole project. Try to enable billing and try again. |
But in the same Console account, I have both apps, and the other one is working fine. The billing account is shared across all my apps. Shouldn't be the other one failing as well? |
It may depend on if this app is using APIs (which require billing) that the other app is not. Billing is not necessary solely for GPG. Another thought, ensure you have not triggered the API usage quota for GPG during your testing. |
That's ok. I checked if I was getting this before, but today, while I got stuck, I've trying in the meantime to integrate Firebase as I did for the other app and created/removed some stuff. Not sure why is display but "I would say it's not related". I double checked; I wasn't getting this before, and I got 2 notifications today after these changes: Since other apps are working fine, notifications appeared just today and this was failing days before (and probably weeks) I wouldn't worry (I'll check it anyway). Edit: about the billing thing, I don't see anything weird |
So your billing account setup is fine, but make sure it is selected as the billing account for the project. Do so by selecting the project associated with the app. Open the navigation menu on the left and select billing. |
All the billing thing was fixed already, and the notification is green now. The problem persists. It should come from another place but Google doesn't want to give me any idea. I just opened this: https://stackoverflow.com/questions/78155719/cant-link-firebase-project-to-google-play Again, I didn't have Firebase before, so this shouldn't be related, but I'm just trying to connect some dots. What I'm going to do now is create a new flutter app with the basics and see if that one has any problem. |
Good call. I am unable to replicate, so I cannot provide any more insight. Nothing stands out to me as a cause for the problem either. I look forward to hearing what you learn. |
I tried with both IDs in a fresh new app and neither of them worked. I have the feeling I'm missing something really stupid (but I don't think so because I went to the tutorial several times). https://github.com/erperejildo/test Steps:
|
I tried today again, but surprisingly, it worked. I didn't change anything at all from yesterday. I was getting UPDATE If we follow the documentation (and comments from @Abedalkareem) it says this: So I had this:
and that does not work. At least not now. Not sure why it worked before for me, but updating the working project like that, breaks it.
Please, update that part of the written tutorial.Let's continue... At this point I'm still logged in but when trying to load the game, it fails saying: When showing the leaderboard I get: For achievements: Are both the same error? I checked already for this, but it's fine: BUT on emulator everything is fine: no popup, logged, achievements, saved games, achievements... |
Those are all the same error. It is an authentication issue. If |
but I haven't changed user. It was always the same one |
I suggest you reach out to Google Play Console support and see if they can provide any insight from their side as to what is causing the issue. Even if it's something in the package or on your end, they can likely give you more specific details of the failure from their end. |
I sent this already to Google and they said they will have a look. Let's see. Testing also with a friend remotely, after he logs in, the app breaks. Not sure why (I don't have his phone with me) |
@theLee3 I could try on a different friend's phone and it was failing there. I found out that the 2 phones failing had Android 9 so I did a new test with 2 emulators. One with Android 14 and the other with Android 9: With the last one, I can't log in. I run I can't see here anything related to Android versions, but if we follow official documentation it says from Android 5. |
Does the emulator with Android 9 have the Google Play Games app installed? If I'm not mistaken, on older Android versions, an attempted Play Games login by an app should lead to a popup to install the GPG app if it is not available. I will have to look into it though. |
I followed all the steps here: https://akdebuging.com/posts/integrate-gamekit-and-google-play-services/
Added to AndroidManifest:
In Google Play Console everything seems fine (the SDK is not marked as done, not sure if related. UPDATE: this is not currently showing up):
When I call this it returns just
null
:The text was updated successfully, but these errors were encountered: