React Native | react-native-google-signin
After i install react-native-google-sigin with
npm i react-native-google-signin
It suddenly crash ( force close ) right when the app start, I have already did all the steps that is told on the github documentation yet when i run my App it crash instantly, without giving any error in the log. ( neither android-log nor adb logcat *:S ReactNative:V ReactNativeJS:V does )
Here are my codes:
build.gradle
// Top-level build file where you can add configuration options mon to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
pileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesAuthVersion = "16.0.1" // <--- use this version or newer
}
repositories {
google()
jcenter()
}
dependencies {
classpath(".android.tools.build:gradle:3.4.1")
classpath '.android.tools.build:gradle:3.1.2' // <--- use this version or newer
classpath '.google.gms:google-services:4.1.0' // <--- use this version or newer
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
}
}
settings.gradle
rootProject.name = 'App'
include ':react-native-reanimated'
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
apply from: file("../node_modules/@react-native-munity/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':react-native-google-signin', ':app'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-signin/android')
include ':app'
app/build.gradle
dependencies {
implementation project(':react-native-reanimated')
implementation project(':react-native-gesture-handler')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation(project(":react-native-google-signin"))
implementation ".facebook.react:react-native:+" // From node_modules
implementation(project(':react-native-maps')){
exclude group: '.google.android.gms', module: 'play-services-base'
exclude group: '.google.android.gms', module: 'play-services-maps'
}
implementation '.google.android.gms:play-services-base:10.0.1'
implementation '.google.android.gms:play-services-maps:10.0.1'
if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
apply plugin: '.google.gms.google-services' // <--- this should be the last line
Can someone help me with this error? because when i uninstall react-native-google-signin with
npm uninstall react-native-google-signin
it works just fine
React Native | react-native-google-signin
After i install react-native-google-sigin with
npm i react-native-google-signin
It suddenly crash ( force close ) right when the app start, I have already did all the steps that is told on the github documentation yet when i run my App it crash instantly, without giving any error in the log. ( neither android-log nor adb logcat *:S ReactNative:V ReactNativeJS:V does )
Here are my codes:
build.gradle
// Top-level build file where you can add configuration options mon to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
pileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesAuthVersion = "16.0.1" // <--- use this version or newer
}
repositories {
google()
jcenter()
}
dependencies {
classpath(".android.tools.build:gradle:3.4.1")
classpath '.android.tools.build:gradle:3.1.2' // <--- use this version or newer
classpath '.google.gms:google-services:4.1.0' // <--- use this version or newer
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
}
}
settings.gradle
rootProject.name = 'App'
include ':react-native-reanimated'
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
apply from: file("../node_modules/@react-native-munity/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':react-native-google-signin', ':app'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-signin/android')
include ':app'
app/build.gradle
dependencies {
implementation project(':react-native-reanimated')
implementation project(':react-native-gesture-handler')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation(project(":react-native-google-signin"))
implementation ".facebook.react:react-native:+" // From node_modules
implementation(project(':react-native-maps')){
exclude group: '.google.android.gms', module: 'play-services-base'
exclude group: '.google.android.gms', module: 'play-services-maps'
}
implementation '.google.android.gms:play-services-base:10.0.1'
implementation '.google.android.gms:play-services-maps:10.0.1'
if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
apply plugin: '.google.gms.google-services' // <--- this should be the last line
Can someone help me with this error? because when i uninstall react-native-google-signin with
npm uninstall react-native-google-signin
it works just fine
Share Improve this question asked Sep 24, 2019 at 10:03 Reza IqronoorReza Iqronoor 951 silver badge7 bronze badges 5- Hello, Have you tried linking the dependency to your project with react-native-link – OsamaD Commented Sep 24, 2019 at 12:13
- did you solve this? – Vincent Dave Te Commented Dec 13, 2019 at 3:19
-
Please add your
package.json
info here too. To debug this it will be helpful to know RN version and google-sign-in version. – Florin Dobre Commented Dec 14, 2019 at 11:32 - The problem for me was the dependency for react >.59 I used 15.0.0 and that fixed the problem.implementation '.google.android.gms:play-services-base:15.0.0' implementation '.google.android.gms:play-services-maps:15.0.0' – Vincent Dave Te Commented Dec 18, 2019 at 1:33
-
Do you have
google-services.json
file? – Rafael Hovsepyan Commented Dec 19, 2019 at 8:27
3 Answers
Reset to default 3In app/build.gradle set
implementation(project(":@react-native-munity_google-signin"))
instead
implementation(project(":react-native-google-signin"))
There are two versions of React Native Google Signin:
react-native-google-signin
for React Native <= 0.59@react-native-munity/google-signin
for React Native >= 0.60
Since you are using the first one, I suppose your version of React Native is <= 0.59, if not, you must switch to the munity version.
Apart from the above, your android/build.gradle
contains a duplicated classpath .android.tools.build:gradle
:
classpath(".android.tools.build:gradle:3.4.1")
classpath '.android.tools.build:gradle:3.1.2' // <--- use this version or newer
Since React Native Google Signin requires the version 3.1.2 or newer, you can safely remove the second one.
Also, based on what is stated in the documentation, your android/app/build.gradle
misses the following implementation:
implementation ".android.support:apppat-v7:23.0.1"
Hope it helps
Since you have Hermes enabled it means you have RN 0.60+
Just use the munity version:
"@react-native-munity/google-signin": "^3.0.3"
RN 0.60+ has autolinking so you don't need these lines:
// settings.gradle
include ':react-native-google-signin', ':app'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-munity/google-signin/android')
// MainApplication.java
new RNGoogleSigninPackage()
I think you should try to use this autolinking for the other libraries too (you might have to use their latest versions)
If still not working you can get more info here
https://github./react-native-munity/react-native-google-signin/blob/master/docs/android-guide.md
(Pay attention that step 4 should not be done unless manual linking is used and double check steps 1-3)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745269767a4619671.html
评论列表(0条)