Ajay Jayendran
Ajay Jayendran

Reputation: 1604

Can't able to Resolve Firebase after Installing google playservice and google repository in Android Studio?

As i change my Windows OS from 8.1 to 10..After Installing windows 10,I start Installed Android Studio 1.5.1.After Installing Android Studio,I have downloaded SDK...After this the Android Studio Opens well..Then i started doing my project..I have created new project..And i am in need of including Firebase to my project..So i have Included respective dependencies for that..

build.gradle(Module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.projects.ajayjayendran.sample"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.google.firebase:firebase-core:10.2.3'
    compile 'com.google.firebase:firebase-database:10.2.3'
    compile 'com.google.firebase:firebase-storage:10.2.3'
    compile 'com.firebaseui:firebase-ui-database:1.1.9'
}
apply plugin: 'com.google.gms.google-services'

build.gradle(Project:Sample)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

I am getting this following Error..I know that this Question is already in Stack Overflow but it does not resolve my problem..I have lost one day..

enter image description here

In old Questions,they gave solution as Installing Google Repository and Google play Service in SDK Manager..Even after Installing this,I am getting this Same Error..Please anyone here Resolve my problem..

enter image description here

Thanks in Advance :)

Upvotes: 1

Views: 1709

Answers (1)

AL.
AL.

Reputation: 37778

Created a new project, copied your gradle files, and managed to reproduce the errors. However, I managed to make it compile smoothly after a few changes.

  1. I don't know where you got 10.2.3 versions, but I edited the Firebase dependencies back to 10.2.4 (see versions here).
  2. I'm presuming it's just a typo, but the Firebase UI library doesn't have a specified 1.1.9 version (see the versions here). I changed mine to 1.1.0.

After clean building the project with the changes above, it started to throw a different error. One where you have to make sure that the Compile SDK version, build tools version, and the support library versions are aligned (see this answer).

  1. So from the above post, I edited out the compileSdkVersion to 25 and used the latest support library versions (25.x.x).

The resulting app gradle file (builds with no problems):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.gradle.testapp2"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.android.support:recyclerview-v7:25.1.1'
    compile 'com.android.support:cardview-v7:25.1.1'
    compile 'com.google.firebase:firebase-core:10.2.4'
    compile 'com.google.firebase:firebase-database:10.2.4'
    compile 'com.google.firebase:firebase-storage:10.2.4'
    compile 'com.firebaseui:firebase-ui-database:1.1.0'
}
apply plugin: 'com.google.gms.google-services'

P.S.: It's also advisable to have your Android SDK Tools updated.

Upvotes: 1

Related Questions