无法解决依赖关系反应本机谷歌适合

时间:2018-04-11 22:22:03

标签: react-native google-fit

添加包后,我无法构建项目。错误:

配置项目':app'。

时出现问题
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':react-native-google-fit'.
      > Could not resolve all dependencies for configuration ':react-native-google-fit:_debugPublishCopy'.
         > Could not find com.google.android.gms:play-services-auth:11.6.0.
           Searched in the following locations:
               file:/Users/wojciech/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-auth/11.6.0/play-services-auth-11.6.0.pom
               file:/Users/wojciech/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-auth/11.6.0/play-services-auth-11.6.0.jar
               file:/Users/wojciech/Documents/dev/uni/swifty-app/Swifty/android/sdk-manager/com/google/android/gms/play-services-auth/11.6.0/play-services-auth-11.6.0.jar
               file:/Users/wojciech/Library/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-auth/11.6.0/play-services-auth-11.6.0.pom
               file:/Users/wojciech/Library/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-auth/11.6.0/play-services-auth-11.6.0.jar
               file:/Users/wojciech/Documents/dev/uni/swifty-app/Swifty/android/sdk-manager/com/google/android/gms/play-services-auth/11.6.0/play-services-auth-11.6.0.jar
           Required by:
               Swifty:react-native-google-fit:unspecified
         > Could not find com.google.android.gms:play-services-fitness:11.6.0.
           Searched in the following locations:
               file:/Users/wojciech/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-fitness/11.6.0/play-services-fitness-11.6.0.pom
               file:/Users/wojciech/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-fitness/11.6.0/play-services-fitness-11.6.0.jar
               file:/Users/wojciech/Documents/dev/uni/swifty-app/Swifty/android/sdk-manager/com/google/android/gms/play-services-fitness/11.6.0/play-services-fitness-11.6.0.jar
               file:/Users/wojciech/Library/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-fitness/11.6.0/play-services-fitness-11.6.0.pom
               file:/Users/wojciech/Library/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-fitness/11.6.0/play-services-fitness-11.6.0.jar
               file:/Users/wojciech/Documents/dev/uni/swifty-app/Swifty/android/sdk-manager/com/google/android/gms/play-services-fitness/11.6.0/play-services-fitness-11.6.0.jar
           Required by:
               Swifty:react-native-google-fit:unspecified

提前致谢。

1 个答案:

答案 0 :(得分:0)

有两种常见的解决方法。  1.在allprojects / repositoris部分下将其添加到android / build.gradle文件中

maven {
        url 'https://maven.google.com'
}

看起来应该像这样:

allprojects {
    repositories {
        mavenLocal()
        maven {
            url 'https://maven.google.com'
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url "https://jitpack.io" }
        jcenter()
    }
}
  1. 另一种方法(对我有用)-用于react-native-google-fit lib,并且在android / build.gradle中将库更改为依赖项

    编译'com.google.android.gms:play-services-auth +'

    编译'com.google.android.gms:play-services-fitness +'

在您的项目中使用分叉