【问题标题】:Why does this error happen when I try to add firebase to my Android project?为什么当我尝试将 firebase 添加到我的 Android 项目时会发生此错误?
【发布时间】:2019-04-20 11:49:19
【问题描述】:

我在这里尝试使用 firebase 我的代码 https://i.stack.imgur.com/WcbeT.png

           // I tried these solution and doesn't work 

   //  1. remove the

            implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
        //    and add only

            implementation 'com.google.firebase:firebase-database:16.0.1'

    //      2.
            allprojects {
              repositories {
               google()
               maven { url "https://maven.google.com" }
             }
            }

【问题讨论】:

  • 更新你的依赖。

标签: android firebase kotlin


【解决方案1】:

将以下依赖项添加到您的应用程序 gradle(根据您的需要更新):

实现 'com.google.firebase:firebase-core:x.x.x'

刚刚检查了您提供的屏幕截图,此行末尾有 extra :15.0.0 删除,您就可以开始了:

【讨论】:

    【解决方案2】:

    默认情况下,Android Studio 的最新版本将添加一个具有两个“核心值”的依赖项,正如您在上面所说的。

    确保在同步之前,您有一个核心,例如

    implementation 'com.google.firebase:firebase-database:16.0.1'
    

    而不是

    implementation 'com.google.firebase:firebase-database:15.0.0:16.0.1'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-10
      • 1970-01-01
      • 1970-01-01
      • 2020-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-23
      相关资源
      最近更新 更多