我已按照https://github.com/apptailor/react-native-google-signin说明中的所有步骤在React Native中使用Android环境(iOS中没有问题)进行此设置,但在运行{{1}时遇到以下错误}
react-native run-android
我已将以下内容添加到顶级build.gradle:
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> A problem occurred configuring project ':react-native-google-signin'.
> Could not resolve all dependencies for configuration ':react-native-google-signin:_debugCompile'.
> Could not find com.google.android.gms:play-services-auth:8.3.0.
Searched in the following locations:
file:/Users/steven/.m2/repository/com/google/android/gms/play-services-auth/8.3.0/play-services-auth-8.3.0.pom
file:/Users/steven/.m2/repository/com/google/android/gms/play-services-auth/8.3.0/play-services-auth-8.3.0.jar
https://jcenter.bintray.com/com/google/android/gms/play-services-auth/8.3.0/play-services-auth-8.3.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-auth/8.3.0/play-services-auth-8.3.0.jar
file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-auth/8.3.0/play-services-auth-8.3.0.pom
file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-auth/8.3.0/play-services-auth-8.3.0.jar
Required by:
PowerToolSafe:react-native-google-signin:unspecified
以下是app-level build.gradle:
'com.google.gms:google-services:1.5.0'
我尝试过不同版本的google-services,但最终仍然遇到了构建错误。在JCenter中,我甚至看不到apply plugin: 'com.google.gms.google-services'
...
dependencies {
...
compile project(":react-native-google-signin")
}
。
谢谢!
答案 0 :(得分:3)
通过从Android SDK Manager添加Google Repository
和Google Play services
来解决此问题。它在第一次构建时失败了,但之后因任何原因完成了。