Hi,
When trying to build the project after installing and linking i have the following error:
C:\path\MainApplication.java:6: error: package co.apptailor.googlesignin does not exist
import co.apptailor.googlesignin.RNGoogleSigninPackage;
I double checked and import co.apptailor.googlesignin.RNGoogleSigninPackage; is in MainApplication.java
Please provide the version of your
npm install react-native-google-signin --save
react-native link react-native-google-signin
react-native run-android
Succesful build
C:\path\MainApplication.java:6: error: package co.apptailor.googlesignin does not exist
import co.apptailor.googlesignin.RNGoogleSigninPackage;
^
C:\path\MainApplication.java:40: error: cannot find symbol
new RNGoogleSigninPackage(),
^
symbol: class RNGoogleSigninPackage
Note: C:\path\MainApplication.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
:app:compileDebugJavaWithJavac FAILED
Looks like the library is not linked properly. Did you follow Android installation guide?
Not thoroughly I guess 馃槃
I was missing:
compile(project(":react-native-google-signin")){
exclude group: "com.google.android.gms" // very important
}
compile 'com.google.android.gms:play-services-auth:9.2.1' // should be at least 9.0.0
in build.gradle
Thanks.
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "$projectDir/../node_modules/react-native/android" }
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion safeExtGet('compileSdkVersion', 26)
buildToolsVersion = '28.0.2'
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 26)
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '26.1.0')}"
implementation "com.google.android.gms:play-services-auth:${safeExtGet('googlePlayServicesAuthVersion', '16.0.1')}"
implementation "com.facebook.react:react-native:+"
}
Linking solve my problem
Thanks to Johan
react-native link react-native-google-signin
Most helpful comment
Not thoroughly I guess 馃槃
I was missing:
compile(project(":react-native-google-signin")){
exclude group: "com.google.android.gms" // very important
}
compile 'com.google.android.gms:play-services-auth:9.2.1' // should be at least 9.0.0
in build.gradle
Thanks.