Google-signin: Native module RNGoogleSignin tried to override RNGoogleSigninModule error

Created on 25 Aug 2019  路  9Comments  路  Source: react-native-google-signin/google-signin

I am trying to build authentication with Google in my React-Native app. Whenever I run the app it displays this error saying that there is a duplicate but in fact, there is no duplicate.

Steps to Reproduce

  • Create a new RN project
  • Download react-native-google-signin library
  • Follow the steps to configure it in Android app.
  • Run app.

Expected Behavior


It should run normally without errors and displays Google Login.

Actual Behavior


image

Environment


- react-native 0.60.4
- react-native-google-signin 2.0.0

```
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesAuthVersion = "17.0.0"

classpath('com.android.tools.build:gradle:3.5.0')
classpath 'com.google.gms:google-services:4.2.0'


dependencies {
implementation project(':react-native-google-signin')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-reanimated')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
// implementation 'com.google.firebase:firebase-core:17.0.1'
// implementation 'com.google.firebase:firebase-database:18.0.1'
implementation project(':react-native-firebase')

// Add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.0.1'

// Add the SDKs for any other Firebase products you want to use in your app
// For example, to use Firebase Authentication and Cloud Firestore
implementation 'com.google.firebase:firebase-auth:18.1.0'
implementation 'com.google.firebase:firebase-firestore:20.2.0'

if (enableHermes) {
  def hermesPath = "../../node_modules/hermesvm/android/";
  debugImplementation files(hermesPath + "hermes-debug.aar")
  releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
  implementation jscFlavor
}

}

     ```
 packages.add( new RNFirebaseFirestorePackage());
      packages.add(new RNFirebaseAuthPackage());
      packages.add(new RNGoogleSigninPackage());

All 9 comments

hello, thanks for reporting. remove packages.add(new RNGoogleSigninPackage());, that will work.

hello, thanks for reporting. remove packages.add(new RNGoogleSigninPackage());, that will work.

Does authentication work without it?

hello, thanks for reporting. remove packages.add(new RNGoogleSigninPackage());, that will work.

check the official repo, it clearly states that we must insert that line in there. Please read through first before hurrying into conclusions.

Is removing packages.add(new RNGoogleSigninPackage()); solved the problem ?

Is removing packages.add(new RNGoogleSigninPackage()); solved the problem ?

I am sorry, why would I do that? I need that package obviously!

@bimix as the error message suggests, the module is very likely being created twice.

If packages.add(new RNGoogleSigninPackage()); is present only once in MainApplication.java, it is probably added one more time through autolinking. And so you don't need the original call.

@bimix as the error message suggests, the module is very likely being created twice.

If packages.add(new RNGoogleSigninPackage()); is present only once in MainApplication.java, it is probably added one more time through autolinking. And so you don't need the original call.

if its there through auto-linking, where is it then?

Adding packages.add(new RNGoogleSigninPackage()); I got RNGoogleSignin tried to override RNGoogleSigninModule but when i remove packages.add(new RNGoogleSigninPackage()); my application build successfully but when I click login and selected google user on the list it return Please try again.TypeError: Cannot read property of undefined.

For future readers, if you run into similar error, please open a new issue and follow the issue template. Thanks.

Was this page helpful?
0 / 5 - 0 ratings