无法解决:com.google.firebase:firebase-auth:11.0.2

时间:2017-07-21 06:35:38

标签: android firebase android-gradle firebase-authentication build.gradle

我刚刚更新了sdk,google play服务和google存储库,但仍然发生了此错误。请帮忙,我想用电话号码整合身份验证。

SDK Manager

Logcat

Build.gradle模块:项目

    // Top-level build file where you can add configuration options common to all sub-projects/module
return
 buildscript {
    ext.kotlin_version = '1.1.3-2'
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:3.1.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'
apply plugin: 'kotlin-android'


android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.*****"
        minSdkVersion 16
        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.google.firebase:firebase-auth:11.0.2'
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

}

apply plugin: 'com.google.gms.google-services'

7 个答案:

答案 0 :(得分:5)

在Firebase文档中,它说:

  

获得"找不到"错误?确保你有      Android SDK管理器中的最新Google Repository

更新Google信息库也应该有助于处理Failed to resolve问题(在撰写这些文章时,Google信息库版本为57)。

所以解决这个问题应该相当简单。以下是您应该采取的步骤:

  1. 打开SDK Manager。
  2. 在顶部标签页上选择SDK工具。
  3. 向下滚动,在Support Repository下选择Google Repository。
  4. 点击“确定”按钮。
  5. 安装完成后,立即将Firebase依赖关系版本更改为11.0.2。
  6. 点击"立即同步"按钮。
  7. 享受Firebase =)

答案 1 :(得分:0)

好像你忘了加入谷歌播放服务插件添加这些代码行

App level gradle

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    ...
    compile "com.google.firebase:firebase-core:11.0.2"
    compile "com.google.firebase:firebase-auth:11.0.2"
    ...

}
apply plugin: 'com.google.gms.google-services'  <-- this line ath the bottom of it

项目级别gradle

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
    classpath 'com.google.gms:google-services:3.1.0'  <--- This Line
}

答案 2 :(得分:0)

//收到“无法找到”错误?确保你有   // Android SDK管理器中的最新Google Repository

答案 3 :(得分:0)

谷歌已经将他们的新存储库从jcenter转移到了maven谷歌。

添加

google()

项目build.gradle中的内部存储库

答案 4 :(得分:0)

将Googles自己的maven存储库添加到build-gradle文件中:

repositories {
        maven {
            url 'https://maven.google.com'
            // Alternative URL is 'https://dl.google.com/dl/android/maven2/'
        }
    }

来源:https://developer.android.com/studio/build/dependencies.html#google-maven

答案 5 :(得分:0)

为我解决了设置播放服务和Firebase相等版本的问题,

shared_ptr(p).swap(*this)

答案 6 :(得分:-1)

尝试使用旧版本的Auth。

compile 'com.google.firebase:firebase-auth:10.0.1'
相关问题