Closed zarir closed 7 years ago
whats about error event?
The error event gets fired with the following output
***** ERROR: {"type":"error","source":{"apiName":"Ti.Module","bubbleParent":true,"invocationAPIs":[],"_events":{"login":{},"error":{}}},"bubbles":false,"error":"com.google.android.gms.auth.api.signin.GoogleSignInResult@32c2605f","cancelBubble":false}
I think we have to parse the GoogleSignInResult
. Plz wait.
Ok now we have new version with more verbose error message. But I see it is not really verrbose. No reason why.
The new build crashes on redirect once you select a Google account
[WARN] : TiVerify: (Timer-0) [4725,4998] Verifying module licenses...
[WARN] : OpenGLRenderer: Fail to change FontRenderer cache size, it already initialized
[INFO] : TiVerify: (Timer-0) [142,5968] Succesfully verified module licenses
[ERROR] : Surface: getSlotFromBufferLocked: unknown buffer: 0xb89241b0
[ERROR] : TiApplication: (main) [1,12161] Sending event: exception on thread: main msg:java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=0, data=Intent { (has extras) }} to activity {com.planmyfood.app/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.android.gms.auth.api.signin.GoogleSignInAccount.getDisplayName()' on a null object reference; Titanium 6.0.2,2017/02/24 11:22,undefined
[ERROR] : TiApplication: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=0, data=Intent { (has extras) }} to activity {com.planmyfood.app/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.android.gms.auth.api.signin.GoogleSignInAccount.getDisplayName()' on a null object reference
[ERROR] : TiApplication: at android.app.ActivityThread.deliverResults(ActivityThread.java:3988)
[ERROR] : TiApplication: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4038)
[ERROR] : TiApplication: at android.app.ActivityThread.access$1400(ActivityThread.java:150)
[ERROR] : TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1443)
[ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:168)
[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5845)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
[ERROR] : TiApplication: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.android.gms.auth.api.signin.GoogleSignInAccount.getDisplayName()' on a null object reference
[ERROR] : TiApplication: at ti.googlesignin.GooglesigninModule$SignInResultHandler.onResult(GooglesigninModule.java:203)
[ERROR] : TiApplication: at org.appcelerator.titanium.util.TiActivitySupportHelper$1.onResult(TiActivitySupportHelper.java:60)
[ERROR] : TiApplication: at org.appcelerator.titanium.util.TiActivitySupportHelper.onActivityResult(TiActivitySupportHelper.java:113)
[ERROR] : TiApplication: at org.appcelerator.titanium.TiBaseActivity.onActivityResult(TiBaseActivity.java:829)
[ERROR] : TiApplication: at android.app.Activity.dispatchActivityResult(Activity.java:6439)
[ERROR] : TiApplication: at android.app.ActivityThread.deliverResults(ActivityThread.java:3984)
[ERROR] : TiApplication: ... 9 more
can you produce a better formatted log output?
new version with avoiding of this crash
v1.0.8
[ERROR] : JNIUtil: !!! Unable to convert unknown Java object class 'com.google.android.gms.common.api.Status' to JS value !!!
[INFO] : ***** ERROR: {"type":"error","source":{"apiName":"Ti.Module","bubbleParent":true,"invocationAPIs":[],"_events":{"login":{},"error":{}}},"success":false,"bubbles":false,"cancelBubble":false}
{"type":"error","source":{"apiName":"Ti.Module","bubbleParent":true,"invocationAPIs":[],"_events":{"login":{},"error":{}}},"status":12501,"success":false,"bubbles":false,"cancelBubble":false}
Ok now we can looking for 12501
.
New version 1.1.1 with text message
Ok. try next version. 1.1.2
Getting same 12501 error
{"type":"error","source":{"apiName":"Ti.Module","bubbleParent":true,"invocationAPIs":[],"_events":{"login":{},"error":{}}},"message":null,"status":12501,"success":false,"bubbles":false,"cancelBubble":false}
Checked the SHA1 fingerprint and the clientID. Its proper. Is there any additional configuration or permission that needs to be mentioned?
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Following permissions are already included
`
Do you read The article in SO?
Check the below article (comment with 92 up votes) where it mentions we have to use 2 client_ids one for android and other for web application.
http://stackoverflow.com/questions/33583326/new-google-sign-in-android
Do we need the same in our project? We use only one client_id so where do we put the other? The same thing is mentioned in the SO link you have shared.
Hey @zarir I think I know where your problem is. You will need to use the WEB client_id from Google, not Android. Second thing is that, as I have added on the READ.ME of this module repo, you will need to generate a SHA-1 from the Titanium keys. If you're deploying your APK as a development build, you will need to find this devkey on Titanium's Android folder. If it is a Distribution build, you will need to use your created key to generate the SHA-1. Have a look here: https://github.com/AppWerft/Ti.GoogleSignIn/#obtaining-a-sha-1-with-titanium
Thanks a ton @AppWerft and @chmiiller. It was issue with the clientID. I think we need to mention it in the docs specifically that web clientId is to be used.
Explained on this commit
I tried the example given in app.js on HTC One M8 with Android 6.0. I can select the account but then I am unable to get any valid user data in the 'login' eventlistener. It returns the following line
Please find the device log