Google-signin: getting Error: CANCELED code 16

Created on 20 Sep 2018  路  4Comments  路  Source: react-native-google-signin/google-signin


I am working to test sign-in followed by given steps in Android Emulator (Nexus 5 API 26 ). getting error CANCELED and error code is 16

Steps to Reproduce

I can able to check status for GoogleSignin.hasPlayServices(); and popup open to select account. When choose account it show the error CANCELED code 16.

Expected Behavior

It should return user info.

Actual Behavior

it give error CANCELED code 16

Environment

```
React Native Environment Info:
System:
OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
CPU: x64 Intel(R) Core(TM) i3-5010U CPU @ 2.10GHz
Memory: 511.20 MB / 7.69 GB
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 10.10.0 - /usr/bin/node
npm: 6.4.1 - /usr/bin/npm
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.0 => 0.57.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1

package.json

{
"name": "myapp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"native-base": "^2.8.0",
"react": "16.5.0",
"react-native": "0.57.0",
"react-native-elements": "^1.0.0-beta5",
"react-native-fbsdk": "^0.8.0",
"react-native-google-signin": "^1.0.0-rc5",
"react-native-vector-icons": "^5.0.0",
"react-navigation": "^2.14.2"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.45.3",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
}

build.gradle

buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 19
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.0.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}

task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}


dependencies {
compile project(':react-native-google-signin')
compile project(':react-native-fbsdk')
compile project(':react-native-vector-icons')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.google.firebase:firebase-core:16.0.1'
}

// 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'
```

Most helpful comment

ok it is solved, i forgot to use latest google-services.json once added SHA-1. Thanks for help @jozan

All 4 comments

I did setup debug.keystore's SHA-1 with my android fire-base app. but still same.

ok it is solved, i forgot to use latest google-services.json once added SHA-1. Thanks for help @jozan

I'm facing same issue. Tried whatever @tundak commented, still no luck.

Was this page helpful?
0 / 5 - 0 ratings