0

我知道這個問題已經被問了很多,但答案總是要去您的SDK管理器並確保Google Play服務和Google Repository已安裝/更新。無法解決:com.google.firebase:firebase-auth:11.2.2

礦井都已更新和安裝。谷歌播放服務是版本44和谷歌儲存庫是版本58.另外,如果我檢查Android Studio的更新,它說我已安裝最新版本。所以,這不是問題。誰能幫我?

這裏是我的應用程序的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.f irebase:火力核心:11.2.2

錯誤:(26,13)無法解析:com.google.firebase:火力數據庫:11.2.2

回答

1

請這樣添加谷歌的Maven倉庫到您的項目級別build.gradle文件:

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

您最近的評論工作將依賴項更改爲11.0.4。如果它尚未發佈,爲什麼Google會給出Gradle依賴關係行11.2.2 [here](https://firebase.google.com/docs/android/setup)? – Ang

+0

谷歌現在依賴其Maven Repository進行依賴。如果有幫助,請標記爲答案並投票:) –

+1

如果我添加Maven資源庫,它實際上不起作用。我的錯誤是:錯誤:(22,0)對於類型爲org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler的對象,參數[build_sdiqbiqltjtd3q6169ye9png $ _run_closure1 $ _closure4 $ _closure5 @ 44a22eb8]找不到方法maven 。 – Ang