Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to SignIn on HTC #4

Closed
zarir opened this issue Apr 17, 2017 · 23 comments
Closed

Unable to SignIn on HTC #4

zarir opened this issue Apr 17, 2017 · 23 comments

Comments

@zarir
Copy link

zarir commented Apr 17, 2017

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

GSignin: (main) [0,26517] com.google.android.gms.auth.api.signin.GoogleSignInResult@4b31e29`

Please find the device log

[INFO] :   TiApplication: (main) [0,0] checkpoint, app created.
[INFO] :   TiApplication: (main) [62,62] Titanium 6.0.2 (2017/02/24 11:22 undefined)
[INFO] :   MultiDex: VM with version 2.1.0 has multidex support
[INFO] :   MultiDex: install
[INFO] :   MultiDex: VM has multidex support, MultiDex support library is disabled.
[INFO] :   DatabaseHelper: No value in database for platform key: 'unique_machine_id' returning supplied default ''
[INFO] :   DatabaseHelper: No value in database for platform key: 'hardware_machine_id' returning supplied default ''
[WARN] :   V8Object: (main) [505,567] Runtime disposed, cannot set property 'userAgent'
[INFO] :   TiApplication: (main) [48,615] Titanium Javascript runtime: v8
[INFO] :   TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[ERROR] :  SensorManager: uid = 10385
[INFO] :   SensorManager: registerListenerImpl: listener = android.view.OrientationEventListener$SensorEventListenerImpl@50db4b5, sensor = {Sensor name="Accelerometer Sensor", vendor="HTC Group Ltd.", version=1, type=1, maxRange=19.6133, resolution=0.01, power=0.17, minDelay=10000}, delay = 200000, handler = null
[ERROR] :  GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
[INFO] :   TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.planmyfood.app.GoogleSigninActivity@b96a03a
[WARN] :   TiUIScrollView: (main) [95,95] Scroll direction could not be determined based on the provided view properties. Default VERTICAL scroll direction being used. Use the 'scrollType' property to explicitly set the scrolling direction.
[ERROR] :  SensorManager: uid = 10385
[INFO] :   SensorManager: registerListenerImpl: listener = android.view.OrientationEventListener$SensorEventListenerImpl@d5ebddc, sensor = {Sensor name="Accelerometer Sensor", vendor="HTC Group Ltd.", version=1, type=1, maxRange=19.6133, resolution=0.01, power=0.17, minDelay=10000}, delay = 200000, handler = null
[INFO] :   I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8974_LA.BF.1.1.3__release_AU (I3fa967cfef)
[INFO] :   I/Adreno-EGL: OpenGL ES Shader Compiler Version: E031.28.00.02
[INFO] :   I/Adreno-EGL: Build Date: 09/29/15 Tue
[INFO] :   I/Adreno-EGL: Local Branch: mybranch14683032
[INFO] :   I/Adreno-EGL: Remote Branch: quic/master
[INFO] :   I/Adreno-EGL: Local Patches: NONE
[INFO] :   I/Adreno-EGL: Reconstruct Branch: NOTHING
[WARN] :   TiVerify: (Timer-0) [4669,4995] Verifying module licenses...
[INFO] :   TiVerify: (Timer-0) [722,5717] Succesfully verified module licenses
[WARN] :   OpenGLRenderer: Fail to change FontRenderer cache size, it already initialized
[ERROR] :  Surface: getSlotFromBufferLocked: unknown buffer: 0xb88f8330
[ERROR] :  GSignin: (main) [1,17292] com.google.android.gms.auth.api.signin.GoogleSignInResult@5f7311a`
@AppWerft
Copy link
Owner

whats about error event?

@zarir
Copy link
Author

zarir commented Apr 17, 2017

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}

@AppWerft
Copy link
Owner

I think we have to parse the GoogleSignInResult. Plz wait.

@AppWerft
Copy link
Owner

Ok now we have new version with more verbose error message. But I see it is not really verrbose. No reason why.

@zarir
Copy link
Author

zarir commented Apr 17, 2017

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

@AppWerft
Copy link
Owner

can you produce a better formatted log output?

@AppWerft
Copy link
Owner

new version with avoiding of this crash

@zarir
Copy link
Author

zarir commented Apr 17, 2017

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}

@zarir
Copy link
Author

zarir commented Apr 17, 2017

{"type":"error","source":{"apiName":"Ti.Module","bubbleParent":true,"invocationAPIs":[],"_events":{"login":{},"error":{}}},"status":12501,"success":false,"bubbles":false,"cancelBubble":false}

@AppWerft
Copy link
Owner

Ok now we can looking for 12501.

@AppWerft
Copy link
Owner

New version 1.1.1 with text message

@zarir
Copy link
Author

zarir commented Apr 17, 2017

v1.1.1 crash on app start
Notes.pdf

@AppWerft
Copy link
Owner

Ok. try next version. 1.1.2

@zarir
Copy link
Author

zarir commented Apr 17, 2017

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}

@zarir
Copy link
Author

zarir commented Apr 17, 2017

Checked the SHA1 fingerprint and the clientID. Its proper. Is there any additional configuration or permission that needs to be mentioned?

@AppWerft
Copy link
Owner

AppWerft commented Apr 17, 2017

<uses-permission android:name="android.permission.GET_ACCOUNTS" />

@zarir
Copy link
Author

zarir commented Apr 17, 2017

Following permissions are already included

<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.USE_CREDENTIALS"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

@AppWerft
Copy link
Owner

Do you read The article in SO?

@zarir
Copy link
Author

zarir commented Apr 18, 2017

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.

@chmiiller
Copy link
Collaborator

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

@zarir
Copy link
Author

zarir commented Apr 18, 2017

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.

@chmiiller
Copy link
Collaborator

Explained on this commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants