Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed To Resolve: com.google.firebase:firebase-firestore:11.4.2 [duplicate]

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".

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

This is my current project 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
}

This is my current app 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'

I get this message:

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

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

How can I fix this?

like image 407
Tal Barda Avatar asked Oct 04 '17 15:10

Tal Barda


1 Answers

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

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

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

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

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

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

like image 95
Doug Stevenson Avatar answered Nov 04 '22 05:11

Doug Stevenson