简体   繁体   中英

Failed to resolve Firestore Android Studio

I was following a tutorial for Firestore but then this error occured, I have all the necessary things in my project level Gradle file, I checked the other questions similar to mine, and mine isn't the same scenario. Could you please help?

ERROR: Failed to resolve: com.google.firebase:firebase-firestore:16.0.1

App lvl Gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.blindnews.kimh2.blindnews"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-firestore:16.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'

}

apply plugin: 'com.google.gms.google-services'

To solve this, please change the following lines of code:

implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-firestore:16.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'

to

implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-firestore:18.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'

In your top level build.gradle file please be sure to have the latest version of Google Service plugin:

classpath 'com.google.gms:google-services:4.2.0'

First of all, check the latest dependency version. May be you add this line twice thats why gradle can not resolve this:

apply plugin: 'com.google.gms.google-services'

And add class path into your project level gradle file

classpath 'com.google.gms:google-services:4.2.0'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM