google-signin: E/ReactNativeJS: undefined is not an object (evaluating 'RNGoogleSignin.BUTTON_SIZE_ICON') android project

React Native version: react-native:0.47.1, react-native-google-signin version: ^0.11.0

I’ve linked and installed react-native-google-signin, and fulfilled step by step the android guide

Yet I still get the error:

E/ReactNativeJS: undefined is not an object (evaluating ‘RNGoogleSignin.BUTTON_SIZE_ICON’)

This error was issued earlier, yet there is no reliable solution found. I’ve tried to reinstall and relink the module as was proposed yet with no success.

The issue occurs at import stage:

import {GoogleSignin, GoogleSigninButton} from "react-native-google-signin";

Here is my gradle dependencies:

dependencies {
  compile fileTree(dir: "libs", include: ["*.jar"])
  compile 'com.android.support:support-v4:26.+'
  compile 'com.android.support:appcompat-v7:26.+'
  compile 'com.facebook.react:react-native:0.47.1'
  compile(project(":react-native-google-signin")){
      exclude group: "com.google.android.gms" // very important
  }
  compile ('com.google.android.gms:play-services-auth:11.0.4') {
      force = true;
  }
  compile ('com.google.android.gms:play-services-analytics:11.0.4'){
      force = true;
  }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
  from configurations.compile
  into 'libs'
}

apply plugin: 'com.google.gms.google-services' // <--- this should be the last line

`

Here is my android App class:

public class App extends Application implements ReactApplication {


@Override
public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
}

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
        return BuildConfig.DEBUG;
    }

    /**
     * A list of packages used by the app. If the app uses additional views
     * or modules besides the default ones, add more packages here.
     */
    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
                new MainReactPackage(),
                new RNGoogleSigninPackage()
        );
    }
};

}

And here is the full output:

undefined is not an object (evaluating 'RNGoogleSignin.BUTTON_SIZE_ICON') <unknown> index.android.bundle?platform=android&dev=true&hot=false&minify=false:96847:23 loadModuleImplementation index.android.bundle?platform=android&dev=true&hot=false&minify=false:106:12 guardedLoadModule index.android.bundle?platform=android&dev=true&hot=false&minify=false:70:36 _require index.android.bundle?platform=android&dev=true&hot=false&minify=false:54:77 <unknown> index.android.bundle?platform=android&dev=true&hot=false&minify=false:96779:116 loadModuleImplementation index.android.bundle?platform=android&dev=true&hot=false&minify=false:106:12 guardedLoadModule index.android.bundle?platform=android&dev=true&hot=false&minify=false:70:36 _require index.android.bundle?platform=android&dev=true&hot=false&minify=false:54:77 <unknown> index.android.bundle?platform=android&dev=true&hot=false&minify=false:59371:39 loadModuleImplementation index.android.bundle?platform=android&dev=true&hot=false&minify=false:106:12 guardedLoadModule index.android.bundle?platform=android&dev=true&hot=false&minify=false:70:36 _require index.android.bundle?platform=android&dev=true&hot=false&minify=false:54:77 <unknown> index.android.bundle?platform=android&dev=true&hot=false&minify=false:52458:22 loadModuleImplementation index.android.bundle?platform=android&dev=true&hot=false&minify=false:106:12 guardedLoadModule index.android.bundle?platform=android&dev=true&hot=false&minify=false:70:36 _require index.android.bundle?platform=android&dev=true&hot=false&minify=false:54:77 <unknown> index.android.bundle?platform=android&dev=true&hot=false&minify=false:1237:22 loadModuleImplementation index.android.bundle?platform=android&dev=true&hot=false&minify=false:106:12 guardedLoadModule index.android.bundle?platform=android&dev=true&hot=false&minify=false:63:45 _require index.android.bundle?platform=android&dev=true&hot=false&minify=false:54:77 global code index.android.bundle?platform=android&dev=true&hot=false&minify=false:97102:9

What can be done about it?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 9
  • Comments: 16

Most upvoted comments

This is a problem with linking the library. Please check out our example App.

If the problem persist open a new issue with a reproducible example.

Thank you.

Upgrading to react-native 0.48 doesn’t make any difference to me. Still results in the same error.

I am having the same problem in Android. Got this error. screen shot 2018-05-18 at 12 42 27 pm

@jaschaio how did you get it work for Android?

I am having the same problem.

Please note that I have followed the “automatic” part of the iOS guide with cocoapods.

It’s working in Android though.