error Google Signin is undefined - call configure first. Anyone who encountered the same issue and how to fix this? Thank you
react-native: 0.39.2
react-native-google-signin: 0.8.0
Specifically on Xiaomi Redmi 3S (Android 6.0.1, API 23), works fine on simulator.
err = Error: GoogleSignin is undefined - call configure first at new GoogleSigninError (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:75284:219) at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:75355:8 at RCTDeviceEventEmitter.emit (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:6586:23) at MessageQueue.__callFunction (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3982:34) at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3854:7 at guard (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3792:1) at MessageQueue.callFunctionReturnFlushedQueue (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:3853:1) at http://localhost:8081/debuggerWorker.js:71:58 {name: "GoogleSigninError", code: -1, stack: "GoogleSigninError: GoogleSignin is undefined - cal… at http://localhost:8081/debuggerWorker.js:71:58", message: "GoogleSignin is undefined - call configure first"}
Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9001, result=0, data=null} to activity {com.qfolio.debug/com.qfolio.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.android.gms.auth.api.signin.GoogleSignInResult.isSuccess()' on a null object reference
at android.app.ActivityThread.deliverResults(ActivityThread.java:3706)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3749)
at android.app.ActivityThread.access$1400(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1400)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.android.gms.auth.api.signin.GoogleSignInResult.isSuccess()' on a null object reference
at co.apptailor.googlesignin.RNGoogleSigninModule.handleSignInResult(RNGoogleSigninModule.java:301)
at co.apptailor.googlesignin.RNGoogleSigninModule.onActivityResult(RNGoogleSigninModule.java:57)
at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:261)
at com.facebook.react.XReactInstanceManagerImpl.onActivityResult(XReactInstanceManagerImpl.java:627)
at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:135)
at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:77)
at com.qfolio.MainActivity.onActivityResult(MainActivity.java:10)
at android.app.Activity.dispatchActivityResult(Activity.java:6508)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3702)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3749)
at android.app.ActivityThread.access$1400(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1400)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
Even i'm facing the same issue.
Hello guys, i'm facing the same issue. How to fix it?
Just initalize the sigin setup before you sign out. It will work fine. Write down to me If you face any more issues @venkata.[email protected]
Hi @peoplevenkat, I got the same issue.
I have configure GoogleSignIn like this
GoogleSignin.configure({
scopes: CONFIG.GOOGLE_SERVICE.SCOPES,
webClientId: CONFIG.GOOGLE_SERVICE.CLIENT_ID,
offlineAccess: true // if you want to access Google API on behalf of the user FROM YOUR SERVER
});
When this line is call
GoogleSignin.signIn()
.then((user) => {
this.googleLoginSucceed(user)
})
.catch((err) => {
this.googleLoginFailed(err)
})
.done()
I see error in logcat:
05-04 14:40:18.033 3655 3672 W System : ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
05-04 14:40:18.034 3655 3672 D ApplicationLoaders: ignored Vulkan layer search path /system/priv-app/PrebuiltGmsCore/lib/x86:/system/fake-libs:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86:/system/lib:/vendor/lib for namespace 0xe9e1b0d0
05-04 14:40:18.062 3738 3738 E AndroidRuntime: FATAL EXCEPTION: main
05-04 14:40:18.062 3738 3738 E AndroidRuntime: Process: com.google.android.gms.ui, PID: 3738
05-04 14:40:18.062 3738 3738 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gms/com.google.android.gms.auth.api.signin.ui.SignInActivity}: java.lang.NullPointerException: Scope must not be null
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at android.app.ActivityThread.-wrap12(ActivityThread.java)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6119)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: Caused by: java.lang.NullPointerException: Scope must not be null
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at lcl.a(:com.google.android.gms:74)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at kmv.a(:com.google.android.gms:845)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at eva.a(:com.google.android.gms:109)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at com.google.android.gms.auth.api.signin.ui.SignInChimeraActivity.a(:com.google.android.gms:283)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at com.google.android.gms.auth.api.signin.ui.SignInChimeraActivity.onCreate(:com.google.android.gms:109)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at com.google.android.chimera.Activity.publicOnCreate(:com.google.android.gms:315)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at bxe.onCreate(:com.google.android.gms:304)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6679)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
05-04 14:40:18.062 3738 3738 E AndroidRuntime: ... 9 more
05-04 14:40:18.086 3655 3672 W System : ClassLoader referenced unknown path:
05-04 14:40:18.086 3655 3672 W System : ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
05-04 14:40:18.087 3655 3672 D ApplicationLoaders: ignored Vulkan layer search path /system/priv-app/PrebuiltGmsCore/lib/x86:/system/fake-libs:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86:/system/lib:/vendor/lib for namespace 0xe9e1b110
05-04 14:40:18.092 3738 3749 I art : Background sticky concurrent mark sweep GC freed 51171(4MB) AllocSpace objects, 7(244KB) LOS objects, 34% free, 6MB/10MB, paused 15.592ms total 224.421ms
05-04 14:40:18.135 1582 2048 W ActivityManager: Force finishing activity com.google.android.gms/.auth.api.signin.ui.SignInActivity
05-04 14:40:18.227 1582 2048 W ActivityManager: Force finishing activity com.pretty.mobile/com.google.android.gms.auth.api.signin.internal.SignInHubActivity
05-04 14:40:18.291 1582 1594 W art : Long monitor contention with owner Binder:1582_7 (2048) at void com.android.server.am.AppErrors.crashApplicationInner(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo)(AppErrors.java:324) waiters=1 in android.content.Intent com.android.server.am.ActivityManagerService.registerReceiver(android.app.IApplicationThread, java.lang.String, android.content.IIntentReceiver, android.content.IntentFilter, java.lang.String, int) for 181ms
05-04 14:40:18.321 3655 3672 I DynamiteModule: Considering local module com.google.android.gms.tagmanager:3 and remote module com.google.android.gms.tagmanager:9
05-04 14:40:18.322 3655 3672 I DynamiteModule: Selected remote version of com.google.android.gms.tagmanager, version >= 9
05-04 14:40:18.364 3655 3672 W System : ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000007/n/x86
05-04 14:40:18.429 3655 3672 W GoogleTagManager: No container asset found in /assets/containers. Checking top level /assets directory for container assets.
05-04 14:40:18.437 1288 1331 D gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
05-04 14:40:18.456 1288 1331 D gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
05-04 14:40:18.436 3655 3672 W GoogleTagManager: Tag Manager's event handler WILL NOT be installed (no container loaded)
05-04 14:40:18.464 1582 3330 I OpenGLRenderer: Initialized EGL, version 1.4
05-04 14:40:18.464 1582 3330 D OpenGLRenderer: Swap behavior 1
05-04 14:40:18.465 1582 3330 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
05-04 14:40:18.465 1582 3330 D OpenGLRenderer: Swap behavior 0
05-04 14:40:18.465 1288 1331 D gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
05-04 14:40:18.465 3655 3672 I GoogleTagManager: Tag Manager initilization took 43ms
05-04 14:40:18.729 1582 1596 W ActivityManager: Activity pause timeout for ActivityRecord{4d50abd u0 com.google.android.gms/.auth.api.signin.ui.SignInActivity t49 f}
05-04 14:40:18.756 3655 3655 D AndroidRuntime: Shutting down VM
05-04 14:40:18.861 3655 3655 E AndroidRuntime: FATAL EXCEPTION: main
05-04 14:40:18.861 3655 3655 E AndroidRuntime: Process: com.pretty.mobile, PID: 3655
05-04 14:40:18.861 3655 3655 E AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9001, result=0, data=null} to activity {com.pretty.mobile/com.pretty.mobile.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.android.gms.auth.api.signin.GoogleSignInResult.isSuccess()' on a null object reference
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:4089)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4132)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at android.app.ActivityThread.-wrap20(ActivityThread.java)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1533)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6119)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.android.gms.auth.api.signin.GoogleSignInResult.isSuccess()' on a null object reference
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at co.apptailor.googlesignin.RNGoogleSigninModule.handleSignInResult(RNGoogleSigninModule.java:310)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at co.apptailor.googlesignin.RNGoogleSigninModule.access$100(RNGoogleSigninModule.java:40)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at co.apptailor.googlesignin.RNGoogleSigninModule$RNGoogleSigninActivityEventListener.onActivityResult(RNGoogleSigninModule.java:55)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:261)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.onActivityResult(ReactInstanceManager.java:659)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:149)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:77)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at com.pretty.mobile.MainActivity.onActivityResult(MainActivity.java:19)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at android.app.Activity.dispatchActivityResult(Activity.java:6932)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:4085)
05-04 14:40:18.861 3655 3655 E AndroidRuntime: ... 9 more
05-04 14:40:18.873 1582 1609 W ActivityManager: Force finishing activity com.pretty.mobile/.MainActivity
05-04 14:40:19.138 1288 1436 D gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
05-04 14:40:19.153 1288 1436 D gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
05-04 14:40:19.160 1288 1436 D gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
05-04 14:40:19.445 1582 1596 W ActivityManager: Activity pause timeout for ActivityRecord{ab40843 u0 com.pretty.mobile/.MainActivity t49 f}
05-04 14:40:19.543 1288 1330 D gralloc_ranchu: gralloc_alloc: format 1 and usage 0x333 imply creation of host color buffer
05-04 14:40:19.559 1582 1596 D : HostConnection::get() New Host Connection established 0x7e24371dc640, tid 1596
05-04 14:40:19.573 1288 1288 E EGL_emulation: tid 1288: eglCreateSyncKHR(1669): error 0x3004 (EGL_BAD_ATTRIBUTE)
05-04 14:40:19.623 1582 1603 W art : Long monitor contention with owner ActivityManager (1596) at android.graphics.Bitmap com.android.server.wm.WindowManagerService.screenshotApplicationsInner(android.os.IBinder, int, int, int, boolean, float, android.graphics.Bitmap$Config, boolean)(WindowManagerService.java:6462) waiters=0 in void com.android.server.wm.WindowAnimator$1.doFrame(long) for 121ms
@nnquy. You have to just Configure Before Sign In you don't have to call SignIn Again. It is showing you error since you have no user details but trying to sign in. I hope it is the issue .May be if you post your code i can figure out better.
Thanks @peoplevenkat, this is my code
Configure in componentWillMount
componentWillMount() {
GoogleSignin.configure({
scopes: CONFIG.GOOGLE_SERVICE.SCOPES,
webClientId: CONFIG.GOOGLE_SERVICE.CLIENT_ID,
offlineAccess: true // if you want to access Google API on behalf of the user FROM YOUR SERVER
});
}
I have a button bind to this method googleLogin()
googleLogin() {
GoogleSignin.signIn()
.then((user) => {
this.googleLoginSucceed(user)
})
.catch((err) => {
this.googleLoginFailed(err)
})
.done()
}
I see in the RNGoogleSigninModule.java, when I click to the button, this method will be called with the intent is null
public void onActivityResult(Activity activity, final int requestCode, final int resultCode, final Intent intent) {
if (requestCode == RNGoogleSigninModule.RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(intent);
handleSignInResult(result, false);
}
}
When I click to this button, the error comes. What should I do?
@nnquy . See you have nothing to change in internal class. Let it be as shown in the example. Don't change anything. And above that . check the log what is happening when click of button. by checking what is user whether null or some data and catch the error message : if it is 12501 that me your google sign in key is mismatch. Above that one small change move from will mount to did mount your configure.
I'm not sure of what's going wrong say if you can share your screen will fix it for you :)
Hi @peoplevenkat, thanks for your help. Could you please ping me on skype ngcqunguyn
Fixed, resetting configure.
For me, this was caused by requesting the email scope when configuring. Missing this out fixes the issue and the scope is included by default anyway.
The issue is because the Java code is creating an array for the scopes of the size that is passed in (for me, I passed in ["email", "profile"] so it had a length of 2. The code then create a copy of the array, but ignores the "email" scope as it add it in itself later. This leaves the array with a length of 2, but only a single value in it ("profile"). The Google SDK then choked on the null value in the array and crashes with Scope must not be null which then returns a null Intent and causes the second crash in my own app.
Same issue. When running GoogleSignin.configure the error that shows in React Native is:
Cannot read property 'configure' of undefined.
Anyone have a solution to this or a working code example?
I fixed the issue by calling
GoogleSignin.configure({})
.then(() => {
console.log('configured')
})
in componentDidMount
@trevans24 your problem solved? if yes please let me know
I have this exact issue. Strangely, it works perfectly on development but then fails on production.
My code is as such:
GoogleSignin.configure({
webClientId: '',
iosClientId: '',
offlineAccess: true,
forceConsentPrompt: true,
})
.then(() => {
GoogleSignin.signIn()
.then(this.handleGoogleLogin)
.catch((err) => {
console.log('WRONG SIGNIN', err)
})
.done()
})
@SjaufStefan make sure you add the debug and release keys properly.
@cvenkat38 I was unaware there was a difference between debug and release keys at all. I just created the OAuth keys in the Google console and I'm using those. Am I wrong to believe it works that way?
EDIT I fixed this issue by simply setting the correct signature in my oauth client API key. I was using my development keystore and should've been using the playstore one.
We had a bug where GoogleSignin.configure resolved a promise too early causing race condition. Basically it means that configuration was not properly done in some cases if you immediately called GoogleSignin.signIn afterwards. It has now been fixed on master and waiting for a release.
@SjaufStefan What comes to your problem we're improving documentation how to set up this library on dev and production environment. Stay tuned. :)
Most helpful comment
For me, this was caused by requesting the
emailscope when configuring. Missing this out fixes the issue and the scope is included by default anyway.The issue is because the Java code is creating an array for the scopes of the size that is passed in (for me, I passed in
["email", "profile"]so it had a length of2. The code then create a copy of the array, but ignores the"email"scope as it add it in itself later. This leaves the array with a length of2, but only a single value in it ("profile"). The Google SDK then choked on thenullvalue in the array and crashes withScope must not be nullwhich then returns anullIntentand causes the second crash in my own app.