Andy Rubin
Andy Rubin

Reputation: 25

android firebase showing error while adding dependency in gradle

Error after adding dependency:

enter image description here

This is my build.gradle app code ,Where i added compile'com.google.firebase:firebase-core:11.6.0' compile 'com.google.firebase:firebase-database:11.6.0' dependency.Which is commented below .

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.example.thelost.fisp_beta10"
        minSdkVersion 16
        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(dir: 'libs', include: ['*.jar'])
    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.+'
    compile 'com.android.support:recyclerview-v7:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support:cardview-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

    //for the firebase
    compile 'com.google.firebase:firebase-core:11.6.0'
    compile 'com.google.firebase:firebase-database:11.6.0'
}
//for the firebase
apply plugin: 'com.google.gms.google-services'

Upvotes: 1

Views: 145

Answers (1)

divyanshu bhargava
divyanshu bhargava

Reputation: 1585

In your root build.gradle file add the repo:

allprojects {
  repositories {
    // ...
  maven { url "https://maven.google.com" }
 }
}

If you are using gradle 4.0 or higher you can replace maven { url "https://maven.google.com" } with just google().

Upvotes: 1

Related Questions