Google signin is not working correctly

Hi

I’m receiving many Google crashes that seem to indicate that the google signin plugin has some issues. Can this be fixed?

The crash logs are as follows…

  at com.naef.jnlua.LuaState.lua_setfield
  at com.naef.jnlua.LuaState.setField (LuaState.java:1447)
  at com.ansca.corona.CoronaLua.newEvent (CoronaLua.java:103)
  at plugin.googleSignIn.LuaLoader$signIn$1.onResult (LuaLoader.java:305)
  at plugin.googleSignIn.LuaLoader$signIn$1.onResult (LuaLoader.java:284)
  at androidx.credentials.playservices.controllers.BeginSignIn.CredentialProviderBeginSignInController$handleResponse$3.invoke$lambda$0 (CredentialProviderBeginSignInController.kt:154)
  at androidx.credentials.playservices.controllers.BeginSignIn.CredentialProviderBeginSignInController$handleResponse$3.$r8$lambda$EuW3IcoqvL70UaolBuSgzA1R6ic (Unknown Source)
  at androidx.credentials.playservices.controllers.BeginSignIn.CredentialProviderBeginSignInController$handleResponse$3$$ExternalSyntheticLambda0.run (D8$$SyntheticClass)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:919)```

I'm hoping someone can resolve this for me?

and this

Exception java.lang.Error:
  at com.naef.jnlua.LuaState.lua_pushstring
  at com.naef.jnlua.LuaState.pushString (LuaState.java:691)
  at com.ansca.corona.CoronaLua.newEvent (CoronaLua.java:102)
  at plugin.googleSignIn.LuaLoader$signIn$1.onResult (LuaLoader.java:305)
  at plugin.googleSignIn.LuaLoader$signIn$1.onResult (LuaLoader.java:284)
  at androidx.credentials.playservices.controllers.BeginSignIn.CredentialProviderBeginSignInController$handleResponse$3.invoke$lambda$0 (CredentialProviderBeginSignInController.kt:154)
  at androidx.credentials.playservices.controllers.BeginSignIn.CredentialProviderBeginSignInController$handleResponse$3.$r8$lambda$EuW3IcoqvL70UaolBuSgzA1R6ic (Unknown Source)
  at androidx.credentials.playservices.controllers.BeginSignIn.CredentialProviderBeginSignInController$handleResponse$3$$ExternalSyntheticLambda0.run (D8$$SyntheticClass)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
  at java.lang.Thread.run (Thread.java:1012)

Is there anyone in the solar team that can look at this? I believe it is a plugin by @Scott_Harrison? Maybe he can fix it?

@solar_dev I just pushed another update which should help,
I really need a reproducible case to verify full fix

Just tested this on problem devices and it seems much better - thank you @Scott_Harrison!

Your sample app is all you need to test this (sometimes it’s not the code but the device!)… I would advise getting any pixel device running android 15 as these seem to be much more strict compared to normal android devices (especially with shaders! no P_DEFAULT on a variable and the shader will not compile)

1 Like

Pushed a new build live and now a new crash. Seems to only be on Android 15. Any ideas?

Exception java.lang.RuntimeException:
  at plugin.googleSignIn.LuaLoader$signIn$1$1.executeUsing (LuaLoader.java:328)
  at com.ansca.corona.CoronaRuntimeTaskDispatcher$TaskEvent.Send (CoronaRuntimeTaskDispatcher.java:179)
  at com.ansca.corona.events.EventManager.sendEvents (EventManager.java:100)
  at com.ansca.corona.Controller.updateRuntimeState (Controller.java:375)
  at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame (CoronaGLSurfaceView.java:442)
  at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun (GLSurfaceView.java:1625)
  at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run (GLSurfaceView.java:1380)
Caused by org.json.JSONException:
  at org.json.JSONTokener.syntaxError (JSONTokener.java:469)
  at org.json.JSONTokener.readObject (JSONTokener.java:412)
  at org.json.JSONTokener.nextValue (JSONTokener.java:104)
  at org.json.JSONObject.<init> (JSONObject.java:168)
  at org.json.JSONObject.<init> (JSONObject.java:185)
  at plugin.googleSignIn.LuaLoader$signIn$1$1.executeUsing (LuaLoader.java:320)

@solar_dev I just pushed a new update which should help with the issue reported

1 Like

It’s still happening unfortunately. This was on a pixel 8 today whilst testing.

Solar version is 3721. plugin.googleSignIn\data.tgz has a date of July 3rd - is this the latest?

Google popup shows > select account shows > upon selection it then crashes

07-10 16:15:06.219 31326 31854 I Corona  : ERROR: Runtime error
07-10 16:15:06.219 31326 31854 I Corona  : java.lang.IllegalArgumentException: illegal type
07-10 16:15:06.219 31326 31854 I Corona  : Java Stack Trace:
07-10 16:15:06.219 31326 31854 I Corona  :      com.naef.jnlua.LuaState.lua_setfield(Native Method)
07-10 16:15:06.219 31326 31854 I Corona  :      com.naef.jnlua.LuaState.setField(LuaState.java:1447)
07-10 16:15:06.219 31326 31854 I Corona  :      network.NetworkGetConnectionStatus.invoke(NetworkGetConnectionStatus.java:76)
07-10 16:15:06.219 31326 31854 I Corona  :      com.ansca.corona.JavaToNativeShim.nativeResume(Native Method)
07-10 16:15:06.219 31326 31854 I Corona  :      com.ansca.corona.JavaToNativeShim.resume(JavaToNativeShim.java:172)
07-10 16:15:06.219 31326 31854 I Corona  :      com.ansca.corona.Controller.updateRuntimeState(Controller.java:366)
07-10 16:15:06.219 31326 31854 I Corona  :      com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:442)
07-10 16:15:06.219 31326 31854 I Corona  :      com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1625)
07-10 16:15:06.219 31326 31854 I Corona  :      com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1380)

Just tried on a P30 Pro (Android 14) and a OnePlus 8 (Android 14) and OnePlus 12 (Android 15) and they all crash - but weirdly don’t surface the crash in the event log. Logcat shows this

07-10 18:39:27.223 13868 14563 E AndroidRuntime: FATAL EXCEPTION: pool-13-thread-1
07-10 18:39:27.223 13868 14563 E AndroidRuntime: java.lang.IllegalArgumentException: illegal type
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at com.naef.jnlua.LuaState.lua_setfield(Native Method)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at com.naef.jnlua.LuaState.setField(LuaState.java:1447)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at plugin.googleSignIn.LuaLoader$signIn$1.onResult(LuaLoader.java:344)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at plugin.googleSignIn.LuaLoader$signIn$1.onResult(LuaLoader.java:284)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at androidx.credentials.CredentialProviderFrameworkImpl$onGetCredential$outcome$2.onResult(CredentialProviderFrameworkImpl.kt:167)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at androidx.credentials.CredentialProviderFrameworkImpl$onGetCredential$outcome$2.onResult(CredentialProviderFrameworkImpl.kt:160)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at android.credentials.CredentialManager$GetCredentialTransport.lambda$onResponse$1(CredentialManager.java:809)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at android.credentials.CredentialManager$GetCredentialTransport.$r8$lambda$KZ8h0IzCqtZJ9s6sISPZis-rA-4(Unknown Source:0)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at android.credentials.CredentialManager$GetCredentialTransport$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
07-10 18:39:27.223 13868 14563 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:1012)

This is 4 out of 4 devices now crashing, please advise as the plugin is unusable on Android now!

Looking into this

Edit: still working on this, trying get my google sign in setup going again, will take me a bit

1 Like

I just pushed a new release and with more bug catching protection

top to bottom is a
Samsung A running Android 15
Pixel 2xl running Android 11
Pixel 6a running Android 15

See video

All are using release from today

Here is full code

local googleSignIn = require "plugin.googleSignIn"
local json = require("json")

local widget = require("widget")

googleSignIn.init({
ios={
    clientId = "817533502476-bsnsu8ivj593flerfh1va02clkh09dtk.apps.googleusercontent.com"
},
android={
    
    clientId = "652763858765-umba64d6ddcr1ihsfcu16p6sqkarqf79.apps.googleusercontent.com"
}
})

timer.performWithDelay(5000, function()
    print("Silent Sign In")
    googleSignIn.silentSignIn(function (e)
        print(json.encode( e ))
        if (e.isError) then
            print(e.error)
        else
            print("successful silent sign in")
            
        end
    end)
end)

local bg = display.newRect( display.contentCenterX, display.contentCenterY, display.actualContentWidth, display.actualContentHeight )
bg:setFillColor( 0,0,1 )

local title = display.newText( "Google Sign In", display.contentCenterX, 40, native.systemFontBold ,30)


function googleListener(event)
    print("googleListener event: " .. event.status)
    print("googleListener event: " .. json.encode(event))
    if (event.isError == true) then
        native.showAlert("Error Sign In", event.error, {"Ok"})
    elseif(event.status == "cancelled") then
        native.showAlert("Sign In Cancelled", json.encode(event), {"Ok"})
    elseif(event.status == "signed in") then
        native.showAlert("Signed In", json.encode(event), {"Ok"})
    elseif(event.status == "signed out") then
        native.showAlert("Signed Out", json.encode(event), {"Ok"})
    end
end

function signIn_onEvent(event)
	if(event.phase == "ended")then
		googleSignIn.signIn(function (e)
            if (e.isError) then
                print(e.error)
            else
                native.showAlert( "Signed In Successfull", json.encode(e), {"Ok"} )
                print(json.encode( e ))
                print("you are signed in")
            end
        end)
	end
end

local signIn = widget.newButton( {
	label = "Sign In",
	fontSize = 20,
	labelColor = { default={ 1, 1, 1 }, over={ 0, 0, 0, 0.5 } },
	x = display.contentCenterX,
	y = display.contentCenterY,
	onEvent = signIn_onEvent
} )

function signOut_onEvent(event)
	if(event.phase == "ended")then
        googleSignIn.disconnect(googleListener)
        googleSignIn.signOut(googleListener)
	end
end

local signOut = widget.newButton( {
	label = "Sign Out/Disconnect",
	fontSize = 20,
	labelColor = { default={ 1, 1, 1 }, over={ 0, 0, 0, 0.5 } },
	x = display.contentCenterX,
	y = display.contentCenterY+100,
	onEvent = signOut_onEvent
} )

@solar_dev let me know if you are experience any more issues. Please include logs and sample code to reproduce

Thanks
Scott

1 Like

@Scott_Harrison Since July 17, when I use Google Sign-In, the account selection popup stopped showing all of my Google accounts except just a few. This issue also affects many other users trying to sign in with Google. Before July 17, I could see all of my accounts in the popup, and there was not any problem - so there is no a problem in setting Google Cloud Console. Also, the plugin stopped providing the accessToken (now I only receive the idToken) after sign in using googleSignIn.signIn(googleListener)

I thought I caused the problem, so I build the source code of my previous app version from before July 17 - and I observed the same problem. But once I installed an artifact build on July 16 from the same version of the source code, it works as expected. Then, I removed all of my external plugins to ensure they don’t conflict with the googleSignIn plugin. The issue still persists. That’s how I came to a conclusion that there might’ve been an update of the plugin that started causing such behaviour of not showing all users and not getting the accessToken.

@iron1ck I pushed a fix for the access token

I am not sure about the missing accounts. To add some background Google issued a requirement to move away from legacy sign in and to credential manager for Android by 2025. The Credential manager may be limiting account choices, I think they have to be tied to your device.

This post was flagged by the community and is temporarily hidden.

Are there other options for native Google sign-in?

Thanks, this fix helps me, and now everything fine!

1 Like