I've just installed this library by running
npm install react-native-google-signin --save
I have the following at the top of my react script:
'use strict';
var React = require('react-native');
var {
StyleSheet,
Component,
View,
Text,
TouchableOpacity,
Navigator,
TextInput
} = React;
and I then appended
import {GoogleSignin, GoogleSigninButton} from 'react-native-google-signin';
I then pressed Run in XCode and it throws the following error
undefined is not an object (evaluating 'RNGoogleSignin.BUTTON_SIZE_ICON')
If I remove
import {GoogleSignin, GoogleSigninButton} from 'react-native-google-signin';
the error is not thrown.
Didn't read the setup instructions properly :/
@anotherstarburst I'm with the same problem. Please tell me the solution
@anotherstarburst you need to import this plugin to xcode and also add the .a library to your build compilation
Well, I think that I did it.
In my xcode project I have Under my project name: RNGoogleSignin.h RNGoogleSignin.m and RNGoogleSigninManager.m
In Build Phases -> Link Binary With Libraries exists GoogleSignIn.framework and my LibPods .a
I realy don't know what I'm missing. I've tried to follow these steps: Add RNGoogleSignin folder to your XCode project but I think that I added the RNGoogleSignin folder at the wrong place. Could you try to help me with these problem?
Please have a look at the sample app to spot any differences with your xcode config
@devfd i'm using sublime text and using this plugin for android apps...can u ..tell the solution to this problem
+1, same issue here
+1
I'm having this problem with Android. I have Google sign in working on iOS
I am also having the same issue as you @elie222.
It happened to me too.
I'm just start a new project and it works.
On Thu, Sep 8, 2016, 19:40 Amy Bakameyer [email protected] wrote:
I am also having the same issue as you @elie222
https://github.com/elie222.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/devfd/react-native-google-signin/issues/56#issuecomment-245659482,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEv7PyiU3f2Bn7TVXcFyPZWhuxtnau6sks5qoDpsgaJpZM4ICvp6
.
Annoying this was working for me at one point for Android and I'm now back to this issue again. Not sure how I fixed it the first time.
if anyone has been able to fix this issue, please post the fix here. I have been struggling with this for a week. As far as I can tell, my xcode config is the same. @anotherstarburst I realize this is an old issue, but do you have any idea how you fixed this? I saw you said that you "read the setup incorrectly." Which part? What change did you make?
@andfs did you ever fix this issue?
@thejohnbackes no i didn't
I gave up google login until someone tell that it's working. I lost almost 3 weeks in this issue.
@thejohnbackes no problem in rn 0.37
@andfs that's what I figured. haven't had a chance to update yet, but I'll post here as well if that resolved the issue.
Did anyone figure it out for Android yet?
I ma also facing the same issue It works fine in IOS but not in android
Can anyone please figure this out fast!
Facing the same issue for Android developing on Mac. Any update?
undefined is not an object (evaluating 'RNGoogleSignin.BUTTON_SIZE_ICON') getting on android on updation of React native 0.39...
anyone can tell how to fix it
Same Issue. Windows. Android
Same issue on Android developing on mac and on react-native 0.39.
I gave up that login too, error is obvious, but where i can find that Native BUTTON_ICON i don't know.
Hopefully author will update documentation for what to do wit that and add it to FAQ or something.
solution:-
first initialise package by writing " new RNGoogleSigninPackage() ", in mainApplication.java constructor and u can comment the BUTTTON_ICON codes in RNGoogleSingin.js because this code does't use in execution.
Having same issue, anyone fixes this issue?
Hello guys! I had that problem and it was because I didn't initialise the project! Following the steps of this link I was able to solve the problem!
https://github.com/devfd/react-native-google-signin/blob/master/ios-guide.md
Alright I had the same problem but it's now working! I went back through the iOS-guide (https://github.com/devfd/react-native-google-signin/blob/master/ios-guide.md) and made sure I did EVERY step. It still wasn't working, but then I cleaned my Xcode project (CMD-SHIFT-K), built the project (CMD-B) (Even though Xcode was showing some errors). After all of this I restarted my app by stopping the packager, closing out of terminal, and running react-native run-ios.
I believe the step that actually made it start working was restarting the packager, but I'm not sure. Hopefully this will help someone else!
Xcode 8.3.2
RN 0.44.0
@uc-pya Hi, I get this problem on Android too - can you be more specific how you fixed it please?
this is my MainApplication.java
package com.mobileapp;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
import com.reactlibrary.googlesignin.RNGoogleSignInPackage;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNGoogleSignInPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
@BerndWessels
hi, you have initialise constructor of RNGoogleSignInPackage in mainApplication.java,
u can check path and make sure your packager is running proper so please restart your packager and check watchman to configure right path,
if still this is coming then u can comment comment the BUTTTON_ICON codes in RNGoogleSingin.js
which saved in node modules ,
import React, { Component, PropTypes } from 'react';
import {
View,
DeviceEventEmitter,
NativeModules,
requireNativeComponent,
} from 'react-native';
const { RNGoogleSignin } = NativeModules;
const RNGoogleSigninButton = requireNativeComponent('RNGoogleSigninButton', {
name: 'RNGoogleSigninButton',
propTypes: {
...View.propTypes,
size: PropTypes.number,
color: PropTypes.number
}
});
class GoogleSigninButton extends Component {
componentDidMount() {
this._clickListener = DeviceEventEmitter.addListener('RNGoogleSigninButtonClicked', () => {
this.props.onPress && this.props.onPress();
});
}
componentWillUnmount() {
this._clickListener && this._clickListener.remove();
}
render() {
return (
);
}
}
GoogleSigninButton.Size = {
Icon: RNGoogleSignin.BUTTON_SIZE_ICON,
Standard: RNGoogleSignin.BUTTON_SIZE_STANDARD,
Wide: RNGoogleSignin.BUTTON_SIZE_WIDE
};
GoogleSigninButton.Color = {
Auto: RNGoogleSignin.BUTTON_COLOR_AUTO,
Light: RNGoogleSignin.BUTTON_COLOR_LIGHT,
Dark: RNGoogleSignin.BUTTON_COLOR_DARK
};
class GoogleSigninError extends Error {
constructor(error, code) {
super(error);
this.name = 'GoogleSigninError';
this.code = code;
}
}
class GoogleSignin {
constructor() {
this._user = null;
}
hasPlayServices(params = {autoResolve: true}) {
return RNGoogleSignin.playServicesAvailable(params.autoResolve);
}
configure(params={}) {
params = [
params.scopes || [], params.webClientId || null, params.offlineAccess || false
];
return RNGoogleSignin.configure(...params);
}
currentUserAsync() {
return new Promise((resolve, reject) => {
const sucessCb = DeviceEventEmitter.addListener('RNGoogleSignInSilentSuccess', (user) => {
this._user = user;
RNGoogleSignin.getAccessToken(user).then((token) => {
this._user.accessToken = token;
this._removeListeners(sucessCb, errorCb);
resolve(this._user);
})
.catch(err => {
this._removeListeners(sucessCb, errorCb);
resolve(this._user);
});
});
const errorCb = DeviceEventEmitter.addListener('RNGoogleSignInSilentError', (err) => {
this._removeListeners(sucessCb, errorCb);
resolve(null);
});
RNGoogleSignin.currentUserAsync();
});
}
currentUser() {
return {...this._user};
}
signIn() {
return new Promise((resolve, reject) => {
console.log("Hi Jarvis function call");
const sucessCb = DeviceEventEmitter.addListener('RNGoogleSignInSuccess', (user) => {
this._user = user;
console.log("Test");
RNGoogleSignin.getAccessToken(user).then((token) => {
this._user.accessToken = token;
this._removeListeners(sucessCb, errorCb);
resolve(this._user);
})
.catch(err => {
this._removeListeners(sucessCb, errorCb);
resolve(this._user);
});
});
const errorCb = DeviceEventEmitter.addListener('RNGoogleSignInError', (err) => {
console.log("Hi Ashu error");
this._removeListeners(sucessCb, errorCb);
reject(new GoogleSigninError(err.error, err.code));
});
RNGoogleSignin.signIn();
});
}
signOut() {
return new Promise((resolve, reject) => {
const sucessCb = DeviceEventEmitter.addListener('RNGoogleSignOutSuccess', () => {
this._removeListeners(sucessCb, errorCb);
resolve();
});
const errorCb = DeviceEventEmitter.addListener('RNGoogleSignOutError', (err) => {
this._removeListeners(sucessCb, errorCb);
reject(new GoogleSigninError(err.error, err.code));
});
this._user = null;
RNGoogleSignin.signOut();
});
}
revokeAccess() {
return new Promise((resolve, reject) => {
const sucessCb = DeviceEventEmitter.addListener('RNGoogleRevokeSuccess', () => {
this._removeListeners(sucessCb, errorCb);
RNGoogleSignin.revokeAccess();
resolve();
});
const errorCb = DeviceEventEmitter.addListener('RNGoogleRevokeError', (err) => {
this._removeListeners(sucessCb, errorCb);
reject(new GoogleSigninError(err.error, err.code));
});
});
}
_removeListeners(...listeners) {
listeners.forEach(lt => lt.remove());
}
}
module.exports = {GoogleSignin: new GoogleSignin(), GoogleSigninButton};
@BerndWessels and once read this instruction and configure according that,
https://github.com/devfd/react-native-google-signin/blob/master/android-guide.md
@uc-pya I've tried comment it out, then the error became BUTTON_SIZE_STANDARD, it's about RNGoogleSignin was not been loaded correctly, don't know why.
I've pasted google-services.json but not working.
It's 2017 now
@marxsm yes right RNGoogleSignin is not proper loading native modules so check watcher config and packager that is proper loading or not and also check setings-gradle and xcode library serach path to load proper assets.
For android, the problem is that the changes made as instructed in the docs are not being persisted. After making the changes in the said files, just sync project with gradle files and then run. Worked for me.
still going through the same problem while integrating with iOS.
Anyone got solution?
Finally, spending one week,
upgrading my react-native-google-signin from 0.8.1 to 0.11.0 resolved my problem.
hope this helps.
@fatinWasta Is that the only thing you've changed? I've tried it with both 0.12.0 and 0.11.0 now and I'm still getting the same issue!
@vanhoutk
Yes, that's what worked for me.
What is your XCode version?
Also if possible share your code .
@fatinWasta I'm actually trying to get it working with Android, I didn't notice that you'd you were integrating with iOS. Thanks anyway!
@vanhoutk Welcome. BDW, still try going to different versions, cause this same sort of problem happened with me while integrating facebook too. So there are high chances that it can be because of version only. Best Lucks. 😇
facing the same issue. v 0.12.0
@kalevigit try downgrading to version 0.6 it's iOS. And try with demo project first.
Just faced this problem. i closed all my bash terminals and the iOS simulator. Then run react-native run-ios again
Hope this helps.
Any updates on this i am still facing the same problem
Hi Guys... I was having the same issue which just got resolved.
all you need to do is in the js files GoogleSignin.ios.js and GoogleSignin.android.js (located in
node_modules/react-native-google-signin/src/) replace the below constants
GoogleSigninButton.Size = {
Icon: RNGoogleSignin.BUTTON_SIZE_ICON,
Standard: RNGoogleSignin.BUTTON_SIZE_STANDARD,
Wide: RNGoogleSignin.BUTTON_SIZE_WIDE
};
GoogleSigninButton.Color = {
Auto: RNGoogleSignin.BUTTON_COLOR_AUTO,
Light: RNGoogleSignin.BUTTON_COLOR_LIGHT,
Dark: RNGoogleSignin.BUTTON_COLOR_DARK
};
with
GoogleSigninButton.Size = {
Icon: '48 x 48',
Standard: '230 x 48',
Wide: '312 x 48'
};
GoogleSigninButton.Color = {
Auto: 'white',
Light: 'blue',
Dark: 'grey'
};
@SantoshShabadi your solution works. Thanks
Same issue in android...
Issue might arise when you are messing with MainApplication.java or MainActivity.java
Solution in the above case:
just unlink react-native-google-signin and link it again.
@SantoshShabadi your solution move me to a new error, help if you see this too?

Hi Everybody I was having the same issue which just got resolved.
My react-native version is 0.50.4
react-natve-google-sign-in version is 0.12.0
I followed this link only automatic linking not mannual
https://github.com/react-native-community/react-native-google-signin/blob/master/ios-guide.md
and one more change in
node_modules/react-native-google-signin/src/
replace the below constants
GoogleSigninButton.Size = {
Icon: RNGoogleSignin.BUTTON_SIZE_ICON,
Standard: RNGoogleSignin.BUTTON_SIZE_STANDARD,
Wide: RNGoogleSignin.BUTTON_SIZE_WIDE
};
GoogleSigninButton.Color = {
Auto: RNGoogleSignin.BUTTON_COLOR_AUTO,
Light: RNGoogleSignin.BUTTON_COLOR_LIGHT,
Dark: RNGoogleSignin.BUTTON_COLOR_DARK
};
with
GoogleSigninButton.Size = {
Icon: '48 x 48',
Standard: '230 x 48',
Wide: '312 x 48'
};
GoogleSigninButton.Color = {
Auto: 'white',
Light: 'blue',
Dark: 'grey'
};
For anyone who's still getting this error, make sure all the installations steps are followed properly.
You can reference detailed guide from the library itself under following path.
"node_modules/react-native-google-signin/docs/ios-guide.md"
If anyone having problem with iOS check that you have successfully installed the pods.
Most helpful comment
I'm having this problem with Android. I have Google sign in working on iOS