This seems like such a simple thing, but I am not very experienced building Native Android operations. I need to get my app signed into Google (they disallow the cut/paste I was using to get the oauth2 auth code).
I added the googleSignIn but am getting the error
module ‘plugin.googleSignIn’ not found:resource (plugin.googleSignIn.lu) does not exist in archive
That did not fix the problem. I will keep playing with it, but still the same result.
I am kind of lost here. I tried the manual approach, copying the .jar file into the libs directory, but now I get duplicate reference:
Type plugin.library.BuildConfig is defined multiple times: /Users/Shared/Mobile/SlikRoad/android/plugin/build/.transforms/74af00c200714dd75c20180828b37193/transformed/classes/classes.dex, /Users/Shared/Mobile/SlikRoad/android/app/build/intermediates/external_file_lib_dex_archives/debug/0_jetified-plugin.googleSignIn.jar:classes.dex
I am not sure the exact sequence, but now it works – with the .jar file manually copied into android/app/libs. I restarted several times, and then I did a clean and rebuild without the .jar file, then run debug with the .jar file.
Still not working. It builds and runs, but apparently the AndroidManifest.xml is confused. Running the gradle script removed my own app Native parts. I can get either my own CoronaApplication to start or the get googleSignIn CoronaApplication to work, but not both. How do I merge this so that they both work?
The result depends on timing, but usually this result from googleSignIn.init(…):
[Correction: init() appears to work fine, but the googleSignIn.signIn(googleSIListener) fails)
E/AndroidRuntime: FATAL EXCEPTION: GLThread 331
Process: com.phosphorlearn.SilkRoad, PID: 8329
java.lang.NullPointerException: null
at com.naef.jnlua.LuaState.lua_pushstring(Native Method)
at com.naef.jnlua.LuaState.pushString(LuaState.java:691)
at plugin.googleSignIn.LuaLoader$MyHandler$1.executeUsing(LuaLoader.java:210)
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:325)
at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:434)
at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1625)
at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1380)
If you want to look at my source, I can share it (1 GB). It is messy because I have been trying several things.
Refinement: when the app is already signed in (omitting my CoronaApplication, signIn works), it crashes at the .signIn. With both included, when I force a signOut [mGoogleSignInClient.signOut();] then call your signIn, I first get a prompt to choose the account and then the stack dump.
More data: if I use silentSignIn(listener), I get no error but it never returns to the listener.
A little more data. I put print statements to see where it is going. It seems to be crashing at the end. I even removed the listener, and that didn’t help. Some kind of interaction with my CoronaApplication is corrupting the stack?
Source:
print("in googleLogin")
if googleSignIn then
local gsistat = googleSignIn.init({
android={
clientID = GAPICIDD,
scopes= {"https://www.googleapis.com/auth/fitness.activity.read https://www.googleapis.com/auth/userinfo.email"}
}
})
print("GSI init returned: "..str(gsistat))
local gsisi = googleSignIn.signIn(googleSIListener)
print("GSI login returned: "..str(gsisi))
else
print("no googleSignIn")
end
Result:
I/Corona: in googleLogin
I/Corona: GSI init returned: nil
I/Corona: GSI login returned: nil
D/: PlayerBase::stop() from IPlayer
D/AudioTrack: stop() called with 190519 frames delivered
D/EGL_emulation: eglMakeCurrent: 0xe3985ea0: ver 3 0 (tinfo 0xd035e6f0)
D/EGL_emulation: eglMakeCurrent: 0xe3985ea0: ver 3 0 (tinfo 0xd035e6f0)
D/EGL_emulation: eglMakeCurrent: 0xe3985ea0: ver 3 0 (tinfo 0xd035e6f0)
D/EGL_emulation: eglMakeCurrent: 0xe3985ea0: ver 3 0 (tinfo 0xd035e6f0)
E/libOpenSLES: frameworks/wilhelm/src/itf/IBufferQueue.cpp:56: pthread_mutex_lock_timeout_np returned 110
D/: PlayerBase::stop() from IPlayer
D/AudioTrack: stop() called with 4410 frames delivered
D/: PlayerBase::stop() from IPlayer
D/AudioTrack: stop() called with 1764 frames delivered
D/: PlayerBase::stop() from IPlayer
D/AudioTrack: stop() called with 882 frames delivered
E/AndroidRuntime: FATAL EXCEPTION: GLThread 324
Process: com.phosphorlearn.SilkRoad, PID: 7105
java.lang.NullPointerException: null
at com.naef.jnlua.LuaState.lua_pushstring(Native Method)
at com.naef.jnlua.LuaState.pushString(LuaState.java:691)
at plugin.googleSignIn.LuaLoader$MyHandler$1.executeUsing(LuaLoader.java:210)
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:325)
at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:434)
at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1625)
at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1380)
I/Process: Sending signal. PID: 7105 SIG: 9
Disconnected from the target VM, address: 'localhost:64624', transport: 'socket'
I built the app without Native, just from the simulator. The login works fine, although it returns ‘canceled’ to the listener (with isError=false). I’ll try to take a video of the sequence to show all the steps, see if I am doing something wrong. I thought it might be the clientID but I tried all the production/debug/web clientIDs and same result.
I did that (in simulator build, not in Native, I have given up on native for now), now it returns error 4.
[the rest of this is a red herring – I was using silentSignIn]
It does not show any signin screens. I checked my marketplace ID to be sure. I will try a few more things to be sure I am doing it right. I get no error in the simulator when it loads the plugin, only when it correctly says not available when I use it.
I have tried the various clientID I have without effect.
Indicates there are no valid auth tokens in the keychain. This error code will be returned by restorePreviousSignIn if the user has not signed in before or if they have since signed out.
Are you getting this error calling googleSignIn.signIn(listener)?
I think I might have misunderstood the directions. It appears I have to include Firebase in my application in order to get google-services.json.
I have used Firebase in the past, so I already have a google-services.json. I just didn’t understand that was required by googleSignin.
Result with google-services.json, the build-settings including that, the clientId copied from google-services.json is the same, “canceled”. I am out of ideas.
A little extra data point: after login and confirmation from 2-factor, sometimes there is a flash of the “choose Google account” window (probably always there but sometimes too quick to see). I assume this is shown first then overwritten by the login screen. That might indicate the problem, where the cancel is coming from?
After that, you will get the login information, but it is impossible to log in to Firebase. I suggest you purchase Mr.Scott’s Firebase Auth after trying it out.
firebaseAuth.signInWithGoogle(Google_IDToken, Google_AccessToken,function (ev)
if(ev.isError) then
native.showAlert( "Error", ev.error ,{"Ok"} )
else
native.showAlert( "Yes", json.encode(ev) ,{"Ok"} )
end
end)
I tried using the web client ID, both in clientId = … and with serverClientId = …
Always the same result: status=“canceled” and blank data, no matter which clientID I use – web, android, android debug (using debug SHA1), or the one in the google-services.json file.
FYI, I do not need Firebase, I only need the oauth authorization code, event.serverAuthCode returned from login. I used to get it with a webview but Google no longer allows that. Then I used a browser asking the user to cut/paste the auth code, but Google no longer allows that starting September.
All I need is a Google sign in with return of event.serverAuthCode.
Also FYI, I am not using Native any more, just simple googleSignIn with Solar2d build.
@Scott_Harrison
Regards, Google says:『 We are discontinuing the Google Sign-In JavaScript Platform Library for web. The library will be unavailable for download after the March 31, 2023 deprecation date. Instead, use the new Google Identity Services for Web.
By default, newly created Client IDs are now blocked from using the older Platform Library, existing Client IDs are unaffected. New Client IDs created before July 29th, 2022 can set plugin_name to enable use of the Google Platform Library.』
Will this have any effect on the existing plugins “GoogleSignIn and FirebaseAuth”?