vardhanv35
vardhanv35

Reputation: 23

Unable to resolve Firestore dependency

This is my app gradle file

apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
    applicationId "com.fitness.perspactive"
    minSdkVersion 17
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

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:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-firestore:10.2.1'
compile 'com.android.support:support-v4:26.0.0-alpha1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

This is my project gradle file

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()
    maven {
        url "https://maven.google.com"
    }
}
}

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

In my application I used Firebase realtime database. Later on, when I also tried to include cloud Firestore, it isn't syncing.

When I tried to sync it, it shows:

Failed to resolve: com.google.firebase:firebase-firestore:10.2.1

Please someone help me.

Upvotes: 2

Views: 7018

Answers (2)

Prarthan Ramesh
Prarthan Ramesh

Reputation: 314

classpath 'com.google.gms:google-services:3.1.0' make sure that your com.google.firebase:firebase-firestore:11.4.2 is meeting the same version preferred by https://firebase.google.com/docs/android/setup

Upvotes: 0

Gil Gilbert
Gil Gilbert

Reputation: 7870

The correct version to use for the recently launched beta of Cloud Firestore is 11.4.2. You can declare a dependency on it like so:

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

All Firebase components should be at the same version so, in your case that would be

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

Make sure you have the latest Google Repository in the Android SDK manager, otherwise you won't be able to find this version either :-).

While you're at it you'll need to upgrade to the latest google-services plugin, version 3.1.1.

All of this and more are documented on the setup page. It's worth going through that step by step and checking that your project has all those things even if you have an existing Firebase-enabled app.

Upvotes: 3

Related Questions