javascript - 反应原生 | 应用程序因“react-native-google-signin”而崩溃
问题描述
反应原生 | 反应原生谷歌登录
在我安装 react-native-google-sigin 之后
npm i react-native-google-signin
它在应用程序启动时突然崩溃(强制关闭),我已经完成了 github 文档中告诉的所有步骤,但是当我运行我的应用程序时它立即崩溃,而在日志中没有给出任何错误。( android-log 和 adb logcat *:S ReactNative:V ReactNativeJS:V 都没有)
这是我的代码:
构建.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesAuthVersion = "16.0.1" // <--- use this version or newer
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.1")
classpath 'com.android.tools.build:gradle:3.1.2' // <--- use this version or newer
classpath 'com.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()
}
}
设置.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-community/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'
应用程序/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 "com.facebook.react:react-native:+" // From node_modules
implementation(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:10.0.1'
implementation 'com.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: 'com.google.gms.google-services' // <--- this should be the last line
有人可以帮我解决这个错误吗?因为当我卸载react-native-google-signin时
npm uninstall react-native-google-signin
它工作得很好
解决方案
在 app/build.gradle 中
implementation(project(":@react-native-community_google-signin"))
设置
implementation(project(":react-native-google-signin"))
推荐阅读
- c# - 如何正确地将 JArray 解析为字符串集合
- python - ValueError: 层dense_2的输入0与层不兼容
- javascript - 如何防止直接在 js/ts 类中更新属性?
- snowflake-cloud-data-platform - 我们可以在程序中使用雪花表函数吗?
- javascript - 如何以角度向 html 发送 REST 响应?
- opencv - cv2.drawContours 函数无法正确绘制轮廓
- python - 如何提高 CNN 去噪自编码器的性能
- docker - 可以拉取公共 Docker Hub 存储库,但无法搜索
- java - Hibernate Statistics 语句计数 - 不正确
- python - 为什么我的 python 多处理不能使用所有 cpu?