Play服务与react-native-maps和react-native-firebase发生冲突

时间:2018-10-08 20:22:16

标签: google-maps firebase react-native gradle

我目前正在尝试使用React Native编写应用程序
在此应用程序中,我想使用Google MapsFirebase,因此我添加了npm软件包react-native-mapsreact-native-firebase

我已使用提供的文档设置了程序包。

现在,当我要编译时,出现此错误:

Failed to capture snapshot of input files for task ':react-native-maps:compileDebugAidl' property 'importDirs' during up-to-date check.
> The library com.google.android.gms:play-services-base is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 11.8.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

问题是,如果我正确理解,则在版本10.8.0中react-native-maps需要google-play-services,而在版本15.0.1中react-native-firebase需要google-play-services

我对build.gradle的依赖(我尝试了很多不同的版本):

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompatv7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules

    compile 'com.google.android.gms:play-services-base:15.0.1'
    compile 'com.google.android.gms:play-services-base:10.8.0'
    implementation project(':react-native-maps')
    implementation project(':react-native-firebase')
    implementation "com.google.firebase:firebase-core:16.0.3"
    implementation "com.google.firebase:firebase-auth:16.0.3"
    implementation "com.google.firebase:firebase-firestore:17.1.0"
}

在此先感谢您的帮助

1 个答案:

答案 0 :(得分:0)

选项1: 您可以在build.gradle

的底部添加此代码。
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

这将禁用Google服务检查。 它没有进行优化,但是根据issue,有些用户没有其他选择。

选项2:

将ext部分添加到您的build.gradle

ext {
    googlePlayServicesVersion   = "15.0.1"
}

source