Can not loging to GPGC

Hi,

For the last days I am trying to work out the leaderboard on my android device.

The problem is that the login is failed. (The gameNetwork.request( “isConnected”) return False and also isErro return True )

Note that the game was publish in Alpha test and all other functionality working well - Including in-App products.
Also the leaderboard was working for me for a while until it stops to work - don’t know why.

This is the code in main.lua 

local function gameNetworkLoginCallback( event ) print ("gameNetwork.request( isConnected):",gameNetwork.request( "isConnected") ) --This print false for k,v in pairs( event ) do print( k,v ) -- This print isError = true end end local function gpgsInitCallback( event ) if not event.isError then print ("222 gpgsInitCallback======================================================" ) gameNetwork.request( "login", { userInitiated=true, listener=gameNetworkLoginCallback } ) else native.showAlert( "Failed!", "NOT able to connect to Google Play.\n Error: ".. event.errorM essage.."\nErrorCode: "..event.errorCode, { "OK" } ) end end -- Login to GPGC gameNetwork.init( "google", gpgsInitCallback )

Part of Build.setting

android =

    {                          

        googlePlayGamesAppId = “624348083571”,

        allowAppsReadOnlyAccessToFiles = false, 

        versionCode = “12”, 

        usesPermissions =

        {

            “android.permission.INTERNET”,

            “android.permission.WRITE_EXTERNAL_STORAGE”,           

            “com.android.vending.BILLING”

        },

        usesFeatures =

        {

            { name = “android.hardware.camera”, required = false },

            { name = “android.hardware.location”, required = false },

            { name = “android.hardware.location.gps”, required = false }

        }

    },

config.lua

local aspectRatio = display.pixelHeight / display.pixelWidth

application =

{

    content =

    {

      

        width = 320, --Default to Iphone 5 Scale (Original 640 * 1136)

        height =  568 ,               

        scale = “zoomStretch”,       

        xAlign =“left”,

        yAlign = “top”,

        imageSuffix =

        {

            – Iphone 4,5,6 - Low. Iphone 6+ - High

            ["@2x"] = 2.5 – from screen width 800 (=320*2.5) and above will consider as high res 

        },

        fps = 60

    },

    license =

    {

        google =

        {

            --key = “624348083111”,

            key = “MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwmED0Wse1yaOLXSQEjbVQF+clWfYt63ys2jHv2lq3+WIJOOGXy7qNCoKOEge257nSlFX/4J9G54Q4tIoBYtTqsx1AjBIpM2BQ1t7RZAllj+4qs4vz/JGo5i93JOfAENheChQuAPC5ckZuAoyNEQumSlK6DTJi8ZHmYadFHuopxzefzWJl2MeGbQpPXky1SxBTdW2uHY2b7/yWuLk1XdWlqVc7KvDUZ8kPj573SJUTZrfinGZgHqaxzYbUG9BurIDh1fBglUYSSMxWN1aSyONmIzrI3DYeeu9nvE4jILgq9PL4wgSHt5tHjYKkD7KqbX7pGxdhvsJWYin0BbofC6x9QIDAAAA”,

        },

    },

}

Hi Yuval;

I’m very curious about this as I am encountering something very similar (but maybe not identical).

I COMPLETELY tested a full GPG setup back around January 20th and EVERYTHING looked wonderful after a lot of hard work. I had 10+ achievements set up. I had 10+ leaderboards set up. I was really pleased with implementation and reliability on devices.

Then I worked on other things for a couple of weeks (primarily for Apple builds) so I didn’t put an Android build back on a device for several weeks.

When I did make a next Android build (around February 12), the very act of calling this:

gameNetwork.request(“login”, {userInitiated=true, listener=gcCallback} )

. . . resulted in an immediate crash of my app (no error message whatsoever doing a logcat of Corona info). This is what the device’s error showed up as:

===============================================================

E/ValidateServiceOp( 7907): Using Google Play games services requires a metadata tag with the name “com.google.android.gms.games.APP_ID” in the application tag of the manifest for com.adveractive.game.wrstampededroid

D/AndroidRuntime(10613): Shutting down VM

W/dalvikvm(10613): threadid=1: thread exiting with uncaught exception (group=0x41760c08)

W/System.err(10613): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.

W/System.err(10613): at com.google.android.gms.internal.dw$h.b(Unknown Source)

W/System.err(10613): at com.google.android.gms.internal.dw$h.b(Unknown Source)

W/System.err(10613): at com.google.android.gms.internal.dw$b.bR(Unknown Source)

W/System.err(10613): at com.google.android.gms.internal.dw$a.handleMessage(Unknown Source)

W/System.err(10613): at android.os.Handler.dispatchMessage(Handler.java:102)

W/System.err(10613): at android.os.Looper.loop(Looper.java:146)

W/System.err(10613): at android.app.ActivityThread.main(ActivityThread.java:5602)

W/System.err(10613): at java.lang.reflect.Method.invokeNative(Native Method)

W/System.err(10613): at java.lang.reflect.Method.invoke(Method.java:515)

W/System.err(10613): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)

W/System.err(10613): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)

W/System.err(10613): at dalvik.system.NativeStart.main(Native Method)

===============================================================

I am building with Version 2016.2830 (2016.2.18) at present.

Note – I do have my “googlePlayGamesAppID” defined in build.settings and I do have a proper google license “key” in config.lua

What version are you using for your builds? I’m just getting around to trying to figure out the problem today. I plan to test further tomorrow.

This is all puzzling/disturbing.

Steve

I’m experiencing a similar problem, everything worked fine since september, but recently users started complaining that they can’t login to their google play account.

Rob, could you tell us if that’s the google play fault or there’s something wrong with the CoronaSDK?

Can each of you look in your console log for errors? (except @sbullock who did). And see if there is something common going on. We haven’t changed anything that I’m aware of.

Also if you could unzip your .apk file and look in the Manifest.xml to see if that appID is getting included somewhere? Google may have changed something on their end.

Once I get this I’ll ask engineering to look into it.

Rob

Hi;

I tested some more.

I just posted a bug report on what I am experiencing.

This code triggers the fatal error bomb immediately when it makes the “login” request. The code is drawn from the Corona docs:

[lua]

local gameNetwork = require( “gameNetwork” )

local function requestCallback( event )

print ("\n================================\n  Got to requestCallback\n================================\n")

print ("\n================================\n  Request Callback Event Type: " … tostring(event.type) … “\n================================\n”)

local isconnected = gameNetwork.request( “isConnected” )

end

local function tryLogin()

        local isconnected = gameNetwork.request( “isConnected” )

        --XX[[  Comment this login request in and out to clearly see that this call to “login” is what bombs the app completely

        gameNetwork.request( “login”,

           {

               userInitiated = true,

               listener = requestCallback

           }

         )

        --XX]]

end

local function initCallback( event )

    if not event.isError then

        native.showAlert( “INIT Success!”, “”, { “OK” }, tryLogin )

    else

        native.showAlert( “INIT Failed!”, event.errorMessage, { “OK” } )

        print( “Error Code:”, event.errorCode )

    end

end

local function onSystemEvent( event )

    if ( event.type == “applicationStart” ) then

        gameNetwork.init( “google”, initCallback )

        return true

    end

end

Runtime:addEventListener( “system”, onSystemEvent )

[/lua]

I am using Corona build #2830.

Steve

Hi Rob;

I’m stumped. In order to do my bug report, I made a sample app (using your “Getting Started > Timer” as its base. The app loads and runs fine. But it bombs (see my bug - (Case 45145) Logging in to Google Play Game Services – Fatal Error) when I try to log in.

To answer your question, I just tried to extract the AndroidManifest.xml file using apktool on my PC to unpack the sample APK file I made. It did NOT EXTRACT properly and there was no manifest file following the extraction (though it did create the output directory and put most everything else in the right place. This was the apktool error and note that this “project” in-full is attached to my bug report. This APK file DOES RUN on my android device! Very strange.

In essence, I cannot answer your question because of this.

[C:\Program Files (x86)\Android\apktool]apktool d Word_Stampede_Android.apk ./wrs

I: Baksmaling…

I: Loading resource table…

Exception in thread “main” brut.androlib.AndrolibException: Could not decode arsc file

        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:56)

        at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:491)

        at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:74)

        at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:66)

        at brut.androlib.Androlib.getResTable(Androlib.java:50)

        at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:189)

        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)

        at brut.apktool.Main.cmdDecode(Main.java:146)

        at brut.apktool.Main.main(Main.java:77)

Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000

        at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)

        at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:44)

        at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:102)

        at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)

        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)

        … 8 more

Rename it to a .zip file instead of .apk and unzip it. No need to use apktool.

Of course I did that first (the simple unzip) and I did not find an “appID” or “APP_ID” – which was why I went to the next logical extra step of trying to look in the entire file with apktool. You hadn’t mentioned to only look in the ASCII portion of the file. :slight_smile:

It is not in the ASCII portion of the file.

I just installed a game of mine that uses GPGS on an Android tablet and it logged in to GPGS without issue.

I’m using 2830.

Here is the relevant portions of my build.settings:

 android = { googlePlayGamesAppId = "123456789012345", largeHeap = true, androidPermissions = { "android.permission.VIBRATE", "android.permission.INTERNET" }, }, plugins = { ["CoronaProvider.gameNetwork.google"] = { -- required publisherId = "com.coronalabs", supportedPlatforms = { android=true }, }, ["CoronaProvider.gameNetwork.apple"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android = true, iphone = true }, }, }, 

and the relevant portions of my main.lua:

local function gpInitCallback(event) print("gp call back") if event.isError then app.isConnected = false else print("Need to login") gameNetwork.request( "login", { userInitiated=true, listener=gcLoginCallback }) end print("done with gp callback") end local function authorize() print("\*\*\* connecting to game center.") if device.isGoogle then gameNetwork.init("google", gpInitCallback) elseif device.is\_iOS then gameNetwork.init("gamecenter", gcLoginCallback) end end

Now my app is Live in the store, has been for a long time. I’ve not made any changes to any of this other than prettying up the spacing in my build.settings before posting it here.

Rob

I just looked at the bug submission and I do see one thing different. I’m using:

googlePlayGamesAppId

You’re using

googlePlayGamesAppI_D_

Try changing the last “d” to lower case and give it a try.

Rob

Thanks Rob.

That was it. Not the first time I have done something stupid. :slight_smile: Thanks for your time and help. Really appreciate it.

Steve

Hi Rob,

I conducted several tests for the last days and this is the result of my tests :

  1. If I am testing my application by building the application in debug mode (debug.keystore) all working well. I can login the to the leaderboard and can update/show the leaderboard (so I assume that the code I wrote is OK) BUT

  2. If I am building the application in release mode and running testing on the device I cannot login to the leaderboard (as mention above). Note that I have uploaded the APK to Alpha on google site and define myself as a tester on the device (Yes, I am login as tester to the GPGC on the device) - (Also as general observation, I have also including in my Application in-App purchase and when testing these products - All working well) 

What can be wrong - Why on debug mode is working and release mode it doesn’t.

Tnx

Yuval

Are you logged into your device with the same account that is used for your developer portal?

Rob

Hi,

I am not logged into the device as the developer but as a testers (as define google google console center) - Just to make sure I have reset my device and create it with only one user (as tester).

After reading some in Google I notice for one issue that might be the case for the issue (?).

In the  “LINKED APPS” should I have 2 entries ? one for debug mode and another for relase mode ?

Currently I have one “LINKED APPS” that created with SHA1 = Frrom debug. Should I create new one with SHA1 = From release ?

Yuval 

Hi Yuval;

I’m very curious about this as I am encountering something very similar (but maybe not identical).

I COMPLETELY tested a full GPG setup back around January 20th and EVERYTHING looked wonderful after a lot of hard work. I had 10+ achievements set up. I had 10+ leaderboards set up. I was really pleased with implementation and reliability on devices.

Then I worked on other things for a couple of weeks (primarily for Apple builds) so I didn’t put an Android build back on a device for several weeks.

When I did make a next Android build (around February 12), the very act of calling this:

gameNetwork.request(“login”, {userInitiated=true, listener=gcCallback} )

. . . resulted in an immediate crash of my app (no error message whatsoever doing a logcat of Corona info). This is what the device’s error showed up as:

===============================================================

E/ValidateServiceOp( 7907): Using Google Play games services requires a metadata tag with the name “com.google.android.gms.games.APP_ID” in the application tag of the manifest for com.adveractive.game.wrstampededroid

D/AndroidRuntime(10613): Shutting down VM

W/dalvikvm(10613): threadid=1: thread exiting with uncaught exception (group=0x41760c08)

W/System.err(10613): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.

W/System.err(10613): at com.google.android.gms.internal.dw$h.b(Unknown Source)

W/System.err(10613): at com.google.android.gms.internal.dw$h.b(Unknown Source)

W/System.err(10613): at com.google.android.gms.internal.dw$b.bR(Unknown Source)

W/System.err(10613): at com.google.android.gms.internal.dw$a.handleMessage(Unknown Source)

W/System.err(10613): at android.os.Handler.dispatchMessage(Handler.java:102)

W/System.err(10613): at android.os.Looper.loop(Looper.java:146)

W/System.err(10613): at android.app.ActivityThread.main(ActivityThread.java:5602)

W/System.err(10613): at java.lang.reflect.Method.invokeNative(Native Method)

W/System.err(10613): at java.lang.reflect.Method.invoke(Method.java:515)

W/System.err(10613): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)

W/System.err(10613): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)

W/System.err(10613): at dalvik.system.NativeStart.main(Native Method)

===============================================================

I am building with Version 2016.2830 (2016.2.18) at present.

Note – I do have my “googlePlayGamesAppID” defined in build.settings and I do have a proper google license “key” in config.lua

What version are you using for your builds? I’m just getting around to trying to figure out the problem today. I plan to test further tomorrow.

This is all puzzling/disturbing.

Steve

I’m experiencing a similar problem, everything worked fine since september, but recently users started complaining that they can’t login to their google play account.

Rob, could you tell us if that’s the google play fault or there’s something wrong with the CoronaSDK?

Can each of you look in your console log for errors? (except @sbullock who did). And see if there is something common going on. We haven’t changed anything that I’m aware of.

Also if you could unzip your .apk file and look in the Manifest.xml to see if that appID is getting included somewhere? Google may have changed something on their end.

Once I get this I’ll ask engineering to look into it.

Rob

Hi;

I tested some more.

I just posted a bug report on what I am experiencing.

This code triggers the fatal error bomb immediately when it makes the “login” request. The code is drawn from the Corona docs:

[lua]

local gameNetwork = require( “gameNetwork” )

local function requestCallback( event )

print ("\n================================\n  Got to requestCallback\n================================\n")

print ("\n================================\n  Request Callback Event Type: " … tostring(event.type) … “\n================================\n”)

local isconnected = gameNetwork.request( “isConnected” )

end

local function tryLogin()

        local isconnected = gameNetwork.request( “isConnected” )

        --XX[[  Comment this login request in and out to clearly see that this call to “login” is what bombs the app completely

        gameNetwork.request( “login”,

           {

               userInitiated = true,

               listener = requestCallback

           }

         )

        --XX]]

end

local function initCallback( event )

    if not event.isError then

        native.showAlert( “INIT Success!”, “”, { “OK” }, tryLogin )

    else

        native.showAlert( “INIT Failed!”, event.errorMessage, { “OK” } )

        print( “Error Code:”, event.errorCode )

    end

end

local function onSystemEvent( event )

    if ( event.type == “applicationStart” ) then

        gameNetwork.init( “google”, initCallback )

        return true

    end

end

Runtime:addEventListener( “system”, onSystemEvent )

[/lua]

I am using Corona build #2830.

Steve

Hi Rob;

I’m stumped. In order to do my bug report, I made a sample app (using your “Getting Started > Timer” as its base. The app loads and runs fine. But it bombs (see my bug - (Case 45145) Logging in to Google Play Game Services – Fatal Error) when I try to log in.

To answer your question, I just tried to extract the AndroidManifest.xml file using apktool on my PC to unpack the sample APK file I made. It did NOT EXTRACT properly and there was no manifest file following the extraction (though it did create the output directory and put most everything else in the right place. This was the apktool error and note that this “project” in-full is attached to my bug report. This APK file DOES RUN on my android device! Very strange.

In essence, I cannot answer your question because of this.

[C:\Program Files (x86)\Android\apktool]apktool d Word_Stampede_Android.apk ./wrs

I: Baksmaling…

I: Loading resource table…

Exception in thread “main” brut.androlib.AndrolibException: Could not decode arsc file

        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:56)

        at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:491)

        at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:74)

        at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:66)

        at brut.androlib.Androlib.getResTable(Androlib.java:50)

        at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:189)

        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)

        at brut.apktool.Main.cmdDecode(Main.java:146)

        at brut.apktool.Main.main(Main.java:77)

Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000

        at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)

        at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:44)

        at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:102)

        at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)

        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)

        … 8 more

Rename it to a .zip file instead of .apk and unzip it. No need to use apktool.