How do I fix RN GoogleSignin module linking.

Viewed 10318

Every time I use Yarn everything blows up, which are the instructions given by the react-native-community.

I've tried just doing the npm install --save and then use the link command but nothing works so far.

What am i doing wrong? and how do i fix this.

onsole.error: "RN GoogleSignin native module is not correctly linked. Please read the readme, setup and troubleshooting instructions carefully or try manual linking."
6 Answers

I got this solved by just installing pos for the same:

Step 1: Goto the ios folder inside the app, Check for the pod file it must be having a line

  pod 'RNGoogleSignin', :path => '../node_modules/react-native-google-signin'

if it is not pleased run the command :

  react-native link, 

The above line will appear.

Step 2: Now run the following command.

 pod install 

I gave up on THE react googlesignin stuff after 2 days of tinkering.. I just followed the firebase guide and expo guide and everything works.

Expo google login gets the credentials then firebase checks the crednetials and logs you in.

if you are doing a firebase googlelogin thing and you already have firebase setup you can do something

googleLogin = async () => {
      try {
        const result = await Expo.Google.logInAsync({
          androidClientId: "Your Client ID",
          //iosClientId: YOUR_CLIENT_ID_HERE,  <-- if you use iOS
          scopes: ["profile", "email"]

        })
        if (result.type === "success") {
          const credential = firebase.auth.GoogleAuthProvider.credential(result.idToken, result.accessToken);
             firebase.auth().signInAndRetrieveDataWithCredential(credential).then(function(result){
               console.log(result);
             });
     this.props.navigation.navigate('Where you want to go');
   } else {
     console.log("cancelled")
   }
      } catch (e) {
        console.log("error", e)
      }
  }

For IOS,Please add this in your Pod file and do pod install before run-ios:

pod 'RNGoogleSignin', :path => '../node_modules/@react-native-community/google-signin'

I faced similar issue while manually upgrading react native from 0.59.9 to 0.62.2. I have also uninstalled react-native-google-signin and installed @react-native-community/google-signin before making Pod File change.

i also faced the same error. I had installed the react-native-google-signin using the command: npm i react-native-google-signin

i tried installing it with the command: yarn add react-native-google-signin

and it worked for me.

For Android, try cleaning up your project using cd android && .gradlew clean and then clean up the node modules folder using rm -rf node_modules/ yarn.lock or Package.json.lock if you are using npm. This might not address the issue with the package but it worked for me.

For me this solution work:

  • Just verify if @react-native-community/google-signin is in your package.json

    npm i @react-native-community/google-signin

  • Go to your Podfile and add this line:

    pod 'RNGoogleSignin', :path => "../node_modules/@react-native-community/google-signin"

This maybe work to you.

Related