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

时间:2017-09-14 14:56:09

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

我知道这个问题已经被问了很多,但答案总是要转到SDK Manager并确保安装/更新Google Play服务和Google Repository。

我的更新和安装。 Google Play服务版本为44,Google Repository版本为版本58.此外,如果我检查Android Studio的更新,它会说我安装了最新版本。所以,这不是问题所在。任何人都可以帮助我吗?

这是我的app build.gradle文件

   apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'

defaultConfig {
    applicationId "com.angelakarl.flashchatnewfirebase"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
  }

  dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-database:11.2.2'
compile 'com.google.firebase:firebase-auth:11.2.2'


}

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

这是我的另一个build.gradle文件

  // 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.3.3'
    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
 }

我得到的错误是

错误:(27,13)无法解决:com.google.firebase:firebase-auth:11.2.2

错误:无法解决:com.google.firebase:firebase-core:11.2.2

错误:(26,13)无法解决:com.google.firebase:firebase-database:11.2.2

1 个答案:

答案 0 :(得分:2)

请将Google的Maven资源库添加到您的项目级build.gradle文件中:

allprojects 
{
    repositories 
    {
        jcenter()
        maven { url "https://maven.google.com" // Google's Maven repository}
    }
}