google-signin: google sign in not working when using an actual mobile: tried two views with the same name RNGoogleSigninButton

so I added google-signin into my project, and so far I only used GoogleSignin.configure() and await GoogleSignin.signIn() and it worked well. but recently I tried to also open my app on an actual phone, and I got an error:

 ERROR  Invariant Violation: Tried to register two views with the same name RNGoogleSigninButton, js engine: hermes
 ERROR  Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNGoogleSignin' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["PlatformConstants","LogBox","SourceCode","Timing","AppState","BlobModule","WebSocketModule","DevSettings","DevToolsSettingsManager","Networking","Appearance","DevLoadingView","HeadlessJsTaskSupport","DeviceInfo","UIManager","ImageLoader","SoundManager","IntentAndroid","DeviceEventManager","NativeAnimatedModule","I18nManager","FileReaderModule"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","LinkingManager","RNCSafeAreaContext","NativeReactNativeFeatureFlagsCxx","RNSModule","RNGoogleSignin"]}, js engine: hermes

this is weird, since this is an (almost) empty react native project, and the only packages that use google in my case are firebase and google-signin, so I don’t understand why am I getting this error. it does disappear when I remove the lines GoogleSignin.configure() and await GoogleSignin.signIn(), even If I still have the google-signin package installed.

here is my package.json in case this is a version issue

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 24

Most upvoted comments

i found that google login is not working with expo go. Have to build by android or ios. and then google sign in almost working.

I feel it’s a bit annoying Expo Go is so convenient for testing out a newly added feature or just checking a small change. However, this inconvenience force me to either turn the google sign in off or put my app to testFlight or using eas build

You don’t have to run dev build but keep using Expo Go.

Replace

import { GoogleSignin } from '@react-native-google-signin/google-signin';

by

let GoogleSignin: any = null;

if (!isRunningInExpoGo()) {
  GoogleSignin = require('@react-native-google-signin/google-signin').GoogleSignin;
}

+1

ref: https://docs.expo.dev/build/setup/

eas build --platform android|ios

After completing the build, download and install it on your device(phone). run your project, open the installed app on your phone, and scan / login your expo account on the development system in device as per reference to work on the development build

i found that google login is not working with expo go. Have to build by android or ios. and then google sign in almost working.

can confirm, using eas builds solves this issue

same with me

You don’t have to run dev build but keep using Expo Go.

Replace

import { GoogleSignin } from '@react-native-google-signin/google-signin';

by

let GoogleSignin: any = null;

if (!isRunningInExpoGo()) {
  GoogleSignin = require('@react-native-google-signin/google-signin').GoogleSignin;
}

this can’t be right, the whole idea is just wrong. expo go doesn’t need support google signin and the best solution is to to use a dev build. a long lasting solution

I’m encountering the same issue on both the simulator and a real device. Unfortunately, using EAS build isn’t an option to resolve this, so I may consider removing this feature