Problem in opening Leaderboards on Google Play Game Services

I’ve never used debug key of Corona because I’ve always created my own keystore for my app.

Here’s how I set up my package and my keystore:

  1.  Let’s say my new app is called “My Cool App”

  2.  My package would be com.mycompany.mycoolapp

  3.  My keystore would be  mycoolapp.keystore and mycoolappalias – and I’d create them using the following command:

keytool -genkey -v -keystore mycoolapp.keystore -alias mycoolappalias -keyalg RSA -keysize 2048 -validity 999999

I don’t use any other method or command, and it has always worked for me without a hitch.

Edit:  As for SHA1 for mycoolapp.keystore, I would retrieve it with the following command:

keytool -exportcert -alias mycoolappalias -keystore mycoolapp.keystore -list -v

Naomi

BTW, if you are somehow using Corona debug key when you generate your release build, I imagine it would fail.

And when I say keystore, I mean both keystore and its alias.  They have to be all matching.

Naomi

Those steps you typed are the steps I followed for launching this game’s GPGS, the same steps I used for my previous game which has GPGS working properly. By the way, when I saw the steps were not working, I followed other steps I found in Google documentation for developers.

And I didn’t use the Corona debug key to the release build.

Hmmm, I’m not sure why it isn’t working for you.  Also, I’m curious which step didn’t work (and so you followed other steps.)  Maybe it will give us some clue.

Naomi

What do you think of deleting the client IDs I have on the console and add them again? Do you think it may work or I can have some problem?

Chances are, it has nothing to do with your problem – unless you already deleted client IDs from Google Dev Console even though you have apps with GPGS that are linked to the deleted client ID.  

I’m not sure what kind of errors it would cause by deleting a project/clientID that is linked to apps in GPGS.

You mentioned you already have a published app.  I certainly wouldn’t delete a project/clientID that are linked to your published app.

I would only delete projects/clientIDs that are linked to unpublished apps in Google Play Dev Console.

Basically, I wouldn’t start deleting things from Google Dev Console unless I know exactly which projects/clientIDs are being used and not used.  If a project/clientID is linked to any of my published apps in GPGS, I wouldn’t delete it.

And if you’ve already deleted one by mistake, you can undelete it within 2 weeks or so after the deletion.  

If your Google Dev Console have many projects that were inadvertently created and currently doing nothing, you may just want to leave them be for now.  

If you have many projects with same name/title, you can change it so that you can easily tell which project is which.  And then, eventually, you can delete the ones that aren’t doing anything.  (The reason why I wouldn’t delete projects right away is to make sure projects-that-shouldn’t-be-deleted don’t end up being deleted.  Having some unused projects sitting around won’t do you any harm.  You can delete it when you are ready to clean and organize – but when things are not quite working right, it might be better to wait.)

Naomi

Edit:  By the way, when you mentioned “console”, I assumed you mean Google Dev Console (not Google Play Dev Console.)

I deleted all the other Client IDs I had on the console and only left the one I obtained from

keytool -exportcert -alias mycoolappalias -keystore mycoolapp.keystore -list -v.

I’ll try to login later… no guarantees… :frowning:

No work, Naomi… It didn’t work yet…

Take a look at the screenshot I’m sending. I “readded” my Client ID for the Corona debug key. The SHA1 of the top Client ID is from the release key and the SHA1 of the bottom Client ID is from the Corona debug key.

Do you see something wrong? Does the game name have to be equal to the keystore name? There are thousands of possibilities passing through my head… 

Screenshot%202014-08-17%2011.22.47.png

I’m not sure what you mean by re-adding your Client ID for the Corona debug key.  Did you mean you combined the screenshots of your projects (one from your release key and another from Corona debug key) to show both Client IDs?

As for how your Client ID looks, the format looks the same as mine.   I have Deep Linking disabled, but I don’t think it makes any difference for signing in to GPGS and showing leaderboards.

Only thing that’s different from mine is the format of your package name.  Mine is com.mycompany.mygame while yours is com.yourcompany.games.yourgame – and I don’t know if package names have any formatting restrictions.  It may not be an issue at all, but you might want to look into it just to make sure.

Naomi

I had deleted all the Client IDs but the main one. Now I readded the Corona debug key with the same SHA1 it had before being deleted.

My previous game has the same package format and GPGS works fine.

This may not be the answer you are looking for, but in my experience if the SHA1 key process gets messaged up, its nearly impossible to rectify it.  It’s something that you need to get right the first time.

I know Naomi was fighting with this, but there are quite a few successful implementations where this is working for people and when I added the game I’m currently working on, I made sure to get the SHA1 stuff right the first pass.

You might need to just punt this setup and start over with a new “GPGS” setup.  I would highly recommend you do not ever try to set things up on Google using a debug key.  I don’t believe you can go back and change this later.  I know people say it’s picking it up from the app, but it’s not picking it up from your running app, but the one you uploaded to GPGS (if you’ve done that already) and they don’t take debug key built apps.

I understand that building keystores is very frustrating.  It’s command line driven.  It’s cryptic.  It’s hard to understand if you don’t know the process well.  Heck, even with my 35 years programming experience, it took me a long time to get a grasp on what’s going on with those commands. 

Rob

I agree with Rob.  You may really want to consider creating a new GPGS setup.

Also, I do not understand why you need to add Corona debug key to the mix.  I’ve never used Corona debug key, and I don’t know how it may affect your GPGS setup.

BTW, SHA1 you see in Google Dev Console uses lowercase letters, while the SHA1 we enter when creating our GPGS must be all UPPERCASE.

You may also want to compare the SHA1 you get with the command key and the SHA1 you see for your project in Google Dev Console.  Check if there are any differences (other than the case difference.)  If the letters and numbers are identical (other than the case difference), then you are using matching SHA1 for your project, but if you’ve got the mismatch, then that may explain why you are getting the errors.

Naomi

The SHA1 hash should not be case sensitive.  It’s a series of hex digits (0-9, A-F) that represents one byte (00-FF).  Case generally doesn’t matter here.  The SHA1 is a type of “signature” and what I mean by that, is it’s a computation based on reading the entirety of a file (in this case the Android release keystore which is a long encrypted string) and generating a value from it that can’t be reversed to generate the original file.  MD5 hashes do this.  The keyhash that frustrates Facebook developers does this. 

In old computer terms, it’s similar to a “Checksum”.  A checksum reads each byte from a file and adds its numeric value to a counter.  Once all the bytes are added up, you have a value, that when the same process is repeated by another run of the checksum on the file, you can compare the two checksums to validate that it’s really the file.   That’s what the SHA1 signature is.  It’s a long Hex string that is computed from the keystore you use (certificate and key). 

When your app is uploaded to the store and linked GPGS can read the keystore and compute the SHA1 from the linked app.  The app you test with and deploy to the users has to use the same keystore, and thus calculating the SHA1 value of the key of the running app verifies it’s really your app trying to talk to GPGS.

This is why you cannot use a debug keystore.  You can’t deploy a debug keystore.  It will never match.  This is why if you upload an alpha or beta build of your app, GPGS can figure out the SHA1 value for you.  If you have not uploaded it yet, you have to run the command line tool and generate it off of the keystore you plan to deploy with.  Again, this cannot be the debug keystore. 

The simplest way to avoid this pitfall seems to be to upload an alpha build of your app to Google Play and then tell GPGS to link to it.  It seems to get the SHA1 key right.  At that point you need to make sure you build with the same package ID as you told Google Play you’re going to use.  This means making sure it’s right in the Corona build screen and make sure you don’t have a different one buried in your build.settings some where.

Rob

Rob, I think the SHA1 we enter in GPGS might be case sensitive.  The Google bug that caused the problem for me in the past was due to the pre-filled SHA1 that was lowercase.  This bug was fixed though.  Now I see SHA1 pre-filled with uppercase letters and identical to the SHA1 I get from command line (even though I still see lowercase SHA1 in Google Dev Console.)  But then, if I’m the only one getting the uppercase SHA1 from command line, then perhaps I’m mistaken.

Anyhow, yes, the whole problem Wiley is having must have something to do with him using debug keystore.

Naomi

For my previous game, I didn’t use the Corona debug key and I got no bug. But in this game I’ve just released, after desperately searching for an answer for the bug, I followed what the “Check the certificate fingerprint” guide on https://developers.google.com/games/services/android/troubleshooting and used the debug key. There is another topic which says I have to have two SHA1 fingerprints: one to debug and one to release. 

You suggest I should create another GPGS setup, but the one I’m using is already published and I can’t remove it anymore. And if I try to create another setup using the SHA1, it says it’s already in use. I guess if I remove the project from Google Developers Console, I’ll not be able to setup it again using the SHA1 of the keystore I used to release my game. Or am I wrong? Can I remove the project from Google Developers Console and setup the GPGS again using the SHA1 of my keystore?

(P.S. Have in mind I used  keytool -exportcert -alias gamealias -keystore game.keystore -list -v  to generate the release key of my game)

@Wiler, I don’t have experience using Corona debug key, so if you’re having problem with testing Leaderboards that was created with the Client ID for debug key, I do not know how it needs to be handled.

However, if you are testing the APK file that:

* uses the release key to generate the APK file

* incorporates leaderboards for Client ID linked to SHA1 of the release key

Then I imagine it can’t be affected by Client ID created for your debug key even if you have created such Client ID.

But… if you are  testing the APK file that:

* uses debug key to generate the APK file

* incorporates leaderboards for Client ID linked to SHA1 of the release key

Then perhaps it’s causing the error due to mismatch (but I’m only guessing…)

Naomi

keytool -exportcert -alias gamealias -keystore game.keystore -list -v

doesn’t generate a keystore.  It reads an existing keystore (in your case named game.keystore, with an alias of gamealias from the current directory you are in) and generates signatures from that file.   This does not actually create a keystore.   If you tell GPGS that you’re going to use the SHA1 value produced by that command, then in Corona SDK you must build for android using that game.keystore with an alias of gamealias.

Perhaps posting a screen shot of your Corona SDK build command will help.

Rob

Naomi, what you said is what I’ve done. Do you understand why I’m almost getting crazy about that? haha

I’m sorry for the mistake, Rob. I used that command to generate the SHA1 certificate.

Wiley, I understand how you feel.  I’ve been there too.

One thing I noticed is that you have not posted the error log you get from the terminal.  All I gathered from your post is that you are having some package name related issue and some App ID related issue – but the error log might be able to tell us more about what exactly might be going wrong.

I don’t know what else to suggest at this point.

Naomi

I got it working, Naomi! O.o

I just removed the Client IDs from the Google Developers Console, linked a fourth app to my game, used the release key to authorise it and it’s working! =D

Thanks for the help, you and Rob! If this is only a dream, I tell you later… hahaha