安装react-native-firebase

时间:2018-06-24 09:13:30

标签: firebase react-native react-native-maps react-native-firebase

我的项目正在使用react-native-mapsreact-native-firebase

按照react-native-firebase安装指南进行操作并进行同步。显示错误

  

其他[= [15.0.1,15.0.1]]的其他图书馆都在请求库com.google.android.gms:play-services-basement,但解析为10.2.4。

这是我的根build.gralde

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.1' // I changed this to latest
        }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

我试图在gms中排除react-native-maps个模块。但这是行不通的。这是我的app/build.gradle

// ...

dependencies {
    implementation(project(':react-native-firebase')) {
        transitive = false
    }
    implementation project(':react-native-image-picker')
    implementation project(':react-native-i18n')
    implementation project(':realm')
    implementation project(':react-native-fast-image')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    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'
        exclude group: 'com.google.android.gms', module: 'play-services-basement'
        exclude group: 'com.google.android.gms', module: 'play-services-tasks'
    }
    implementation project(':react-native-toast')
    implementation "com.android.support:appcompat-v7:27.1.0"
    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.android.gms:play-services-maps:15.0.1"

    implementation "com.google.firebase:firebase-core:15.0.2"
    implementation "com.google.firebase:firebase-messaging:15.0.2"
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    implementation 'com.android.support:multidex:1.0.0'

    implementation "com.facebook.react:react-native:+"  // From node_modules
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.google.gms.google-services'
//GoogleServicesPlugin.config.disableVersionCheck = true <-- this is the only thing to make it works

到目前为止,我所做的唯一一件事就是禁用GooleServicePlugin版本检查,但似乎不太正确。

请帮助。提前致谢。 :(

0 个答案:

没有答案