1

I have updated the firebase-auth dependency version but gradle build always fails. It was working fine for 16.0.1

Error Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.firebase:firebase-auth:16.0.2.

app level gradle file

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.dell.pitchpls"
        minSdkVersion 21
        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'
        }
    }
    buildToolsVersion '27.0.3'

}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.google.firebase:firebase-auth:16.0.2'
    //implementation 'com.google.firebase:firebase-core:16.0.0'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.firebaseui:firebase-ui-database:3.0.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.squareup.okhttp:okhttp:2.5.0'

    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'
}
apply plugin: 'com.google.gms.google-services'

Project level gradle file

    // 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.0'
        classpath 'com.google.gms:google-services:4.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        google()
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
Community
  • 1
  • 1
parag pawar
  • 193
  • 3
  • 13

3 Answers3

1

The problem is resolved following this question. Just had to uncheck the offline work in setting/gradle

parag pawar
  • 193
  • 3
  • 13
0

Try These steps:

  • Open Module setting of the application
  • Under Dependencies tab click on '+' symbol and add dependency manually a
  • Click on apply.
Sajal Singh
  • 365
  • 1
  • 7
  • 15
0

Firebase Documentation

If you visit this link and scroll down to add dependency section, you will find out that gradle dependency version is 16.0.1 only

Also, to avoid such errors, let Android Studio do automatically for you.

For this, in Android Studio, go to: Tools-->Firebase (This will open a Firebase Assistant)

Now choose your category like Authentication,Analytics,Cloud Messaging,etc --> Click on "Setup your category" and proceed with the steps mentioned there. It will automatically add all the gradle files and generated JSON file.

Akshay Chopra
  • 1,035
  • 14
  • 10