React本机-本机-google-signin
在我安装了react本机-google-sigin之后
npm i react-native-google-signin当应用程序启动时,它突然崩溃(强制关闭),我已经完成了github文档中告诉我的所有步骤,但当我立即运行app崩溃时,日志中没有任何错误。( android-log和adb logcat *:S React原住民:v ReactNativeJS:V nor )
这是我的密码:
build.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()
}
}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-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'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它工作得很好
发布于 2019-10-22 16:45:56
在app/build.gradle中设置implementation(project(":@react-native-community_google-signin"))
implementation(project(":react-native-google-signin"))发布于 2019-12-13 11:35:10
are本机Google签名有两个版本:
react-native-google-signin for React本地<= 0.59@react-native-community/google-signin for React >= 0.60由于您使用的是第一个版本,我想您的Reacti原住民版本是<= 0.59,如果没有,您必须切换到社区版本。
除此之外,您的android/build.gradle还包含一个复制的classpath com.android.tools.build:gradle。
classpath("com.android.tools.build:gradle:3.4.1")
classpath 'com.android.tools.build:gradle:3.1.2' // <--- use this version or newer由于React本机Google需要3.1.2或更高版本,所以您可以安全地删除第二个版本。
此外,根据文档中所述内容,您的android/app/build.gradle错过了以下实现:
implementation "com.android.support:appcompat-v7:23.0.1"希望它能帮上忙
发布于 2019-12-14 12:17:44
既然您启用了Hermes,就意味着您有RN 0.60+。
只需使用社区版本:
"@react-native-community/google-signin": "^3.0.3"
RN 0.60+有自动收费,所以您不需要这些行
// settings.gradle
include ':react-native-google-signin', ':app'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/google-signin/android')
// MainApplication.java
new RNGoogleSigninPackage()我认为您也应该尝试对其他库使用这种自动连接(您可能需要使用它们的最新版本)。
如果你仍然不工作,你可以在这里得到更多的信息。
(请注意,除非使用手动连接并检查步骤1-3,否则不应执行步骤4)。
https://stackoverflow.com/questions/58077816
复制相似问题