尝试导入firebase-ui时出错

时间:2017-04-13 22:16:25

标签: android firebase android-gradle firebaseui

我需要为我的应用导入firebase-ui,但是当我同步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 :

我刚刚下载了android studio,所以一切都是最新的,一切正常,直到我尝试导入firebase-ui。

的build.gradle(项目: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(模块:应用)

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'
}

1 个答案:

答案 0 :(得分:1)

在项目build.gradle文件中,这个:

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

应该是:

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

要解决Twitter错误,请更新项目build.gradle:

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

Firebase Auth UI需要它。