使用react-native-google-signin在React Native中使用play-services-auth依赖

时间:2015-12-26 00:43:57

标签: android gradle google-api react-native google-authentication

我已按照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") }

谢谢!

1 个答案:

答案 0 :(得分:3)

通过从Android SDK Manager添加Google RepositoryGoogle Play services来解决此问题。它在第一次构建时失败了,但之后因任何原因完成了。

Android SDK Manager