无法解决:com.google.firebase:firebase-firestore:11.4.2 [英] Failed To Resolve: com.google.firebase:firebase-firestore:11.4.2

查看:172
本文介绍了无法解决:com.google.firebase:firebase-firestore:11.4.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在一个已经使用Firebase功能的项目中实现新的Firestore数据库,包括Realtime Database,我想对其进行升级".

I'm trying to implement the new Firestore database in a project that already uses Firebase features, including Realtime Database - which I want to "upgrade".

我正在按照指南进行操作,但是我陷入了困境编译Firestore库.

I'm working according to this guide, but I'm getting stuck at compiling the Firestore library.

这是我当前的项目gradle:

buildscript {
    repositories {
        jcenter()

        maven {
            url 'https://maven.google.com'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.1.0'


    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是我当前的应用gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.tal.wikirace"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

configurations {
    compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })


    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.api-client:google-api-client:1.22.0'
    compile'com.google.api-client:google-api-client-android:1.22.0'
    compile  'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.google.code.findbugs:jsr305:2.0.1'
    compile 'com.google.http-client:google-http-client:1.18.0-rc'
    compile 'com.android.support:design:25.3.1'

    compile 'com.google.android.gms:play-services-auth:11.4.2'
    compile 'com.google.firebase:firebase-auth:11.4.2'
    compile 'com.google.firebase:firebase-database:11.4.2'
    compile 'com.google.firebase:firebase-messaging:11.4.2'
}
apply plugin: 'com.google.gms.google-services'

该项目运行正常,但是当我尝试添加此行时:

The project works fine, but when I try to add this line:

compile 'com.google.firebase:firebase-firestore:11.4.2'

我收到此消息:

Failed To Resolve: com.google.firebase:firebase-firestore:11.4.2

我已经更新了Android SDK Build-ToolsGoogle Play-ServicesSupport Repository,但是没有帮助.

I have updated Android SDK Build-Tools, Google Play-Services and Support Repository, but it didn't help.

我该如何解决?

推荐答案

您在allprojects块中缺少Google Maven存储库:

You're missing the google maven repo in your allprojects block:

allprojects {
    repositories {
        jcenter()
         maven {
            url 'https://maven.google.com'
        }
    }
}

如果您使用的是Gradle 4.1或更高版本,则可以对其进行简化:

If you're using Gradle 4.1 or later, you can simplify it:

allprojects {
    repositories {
        jcenter()
        google()
    }
}

allprojects存储库是用来为您的应用程序定位模块的.在buildscript中,它只为gradle插件定位模块.

allprojects repositories is what's used to locate modules for your app. In buildscript, it locates modules for gradle plugins only.

此外,您还应确保所有Firebase模块具有相同的版本.

Also, you should make sure all of your Firebase modules have the same version.

这篇关于无法解决:com.google.firebase:firebase-firestore:11.4.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆