Search code examples
androidfirebaseandroid-gradle-pluginfirebaseui

Error trying to import firebase-ui


I need to import firebase-ui for my app but I am getting this error when I sync gradle

Error:Could not find com.google.services.gms:google-services:3.0.0.
Searched in the following locations:
    file:/D:/NewAndroid/androidStudios/mew/gradle/m2repository/com/google/services/gms/google-services/3.0.0/google-services-3.0.0.pom
    file:/D:/NewAndroid/androidStudios/mew/gradle/m2repository/com/google/services/gms/google-services/3.0.0/google-services-3.0.0.jar
    https://jcenter.bintray.com/com/google/services/gms/google-services/3.0.0/google-services-3.0.0.pom
    https://jcenter.bintray.com/com/google/services/gms/google-services/3.0.0/google-services-3.0.0.jar
Required by:
    project :

I just downloaded android studio so everything is up to date and everything works until I try to import firebase-ui.

build.gradle(Project:ChatApp)

// 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:2.2.1'
        classpath 'com.google.services.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
}

build.gradle(Module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.emilythacker.chatapp"
        minSdkVersion 15
        targetSdkVersion 25
        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:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

    //Add library
    compile 'com.android.support:design:25.3.1'
    compile 'com.firebaseui:firebase-ui:1.2.0'
}

Solution

  • In your project build.gradle file, this:

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

    should be:

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

    To resolve the twitter error, update your project build.gradle:

    allprojects {
        repositories {
            jcenter()
            maven { url 'https://maven.fabric.io/public' }  // <= ADD THIS
        }
    }
    

    It's needed by Firebase Auth UI.