无法解决:firebase-common

时间:2018-06-23 17:50:00

标签: android firebase firebase-realtime-database firebase-authentication

尝试添加Firebase身份验证时出现此错误

  

无法解决:firebase-common

build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
...
}

dependencies {
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-crash:15.0.2'
implementation 'com.google.firebase:firebase-appindexing:15.0.1'
implementation 'com.google.firebase:firebase-invites:15.0.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.google.firebase:firebase-firestore:16.0.0'
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.google.code.gson:gson:2.8.2'
testImplementation 'junit:junit:4.12'
 }
 // Add to the bottom of the file - this is for Google Firebase
 apply plugin: 'com.google.gms.google-services'

在添加实现'com.firebaseui:firebase-ui-auth:4.0.0'之前,一切似乎都可以正常工作

感谢您的帮助!

1 个答案:

答案 0 :(得分:3)

如果您使用的是Firebaseui 4.0.0版,则它还必须与firebase库版本兼容。

FirebaseUI 4.0.0版具有以下依赖项版本:

     Library        Version
firebase-auth       16.0.1
play-services-auth  15.0.1
firebase-database   16.0.1
firebase-firestore  17.0.1
firebase-storage    16.0.1

更多信息在这里:

https://github.com/firebase/FirebaseUI-Android#compatibility-with-firebase--google-play-services-libraries

也要升级:

implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-crash:15.0.2'
implementation 'com.google.firebase:firebase-appindexing:15.0.1'
implementation 'com.google.firebase:firebase-invites:15.0.1'

到以下:

implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.google.firebase:firebase-appindexing:16.0.1'
implementation 'com.google.firebase:firebase-invites:16.0.1'

检查此:

https://firebase.google.com/support/release-notes/android