如何保留不同版本的Firebase?

时间:2019-06-26 10:06:04

标签: android firebase firebase-realtime-database firebase-cloud-messaging

我需要在项目中使用一组不同的Firebase库。但我收到以下错误:

Unable to resolve dependency for ':@debug/compileClasspath': Could not resolve com.android.support:support-v13:28.0.0.
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-plus:17.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.firebase:firebase-messaging:19.0.0'
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-iid:19.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'

1 个答案:

答案 0 :(得分:2)

如果您要使用最新版本,则可以使用Firebase BoM,在build.gradle中输入以下内容:

dependencies {
  // Import the platform
  implementation platform('com.google.firebase:firebase-bom:20.0.1')

  // When using a BoM, dependencies don't require a specified version
  // If you do specify a version, it overrides the library version specified in the BoM
  implementation 'com.google.firebase:firebase-core'
  implementation 'com.google.firebase:firebase-auth'
  implementation 'com.google.firebase:firebase-firestore'
}

com.google.firebase:firebase-bom:20.0.1将包含所有firebase库的最新版本,然后要使用每个特定的库,请像往常一样添加它们,但不添加版本。

参考文献:

https://firebase.google.com/docs/android/setup#firebase-bom