android - 无法解析 ':app@release/compileClasspath' : Could not resolve com. firebase :firebase-client-android:2. 3.1 的依赖关系

标签 android firebase android-studio

在为 firebase 添加依赖项后同步我的 gradle 文件时出现错误。 这是我的构建 gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.practicumproject.practicumproject"
    minSdkVersion 14
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.google.firebase:firebase-core:9.6.0'
implementation 'com.google.firebase:firebase-auth:9.6.0'
implementation 'com.google.firebase:firebase-database:9.6.0'
implementation 'com.firebase:firebase-client-android:2.3.1'

}

为什么会出现此错误?谁能帮我解决这个问题? 我收到这样的错误:

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.firebase:firebase-client-android:2.3.1. Open File Show Details

最佳答案

添加:

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

在文件底部

在此处遵循此设置:

https://firebase.google.com/docs/android/setup

删除:

implementation 'com.firebase:firebase-client-android:2.3.1'

因为根据此页面已弃用:

https://www.firebase.com/docs/android/quickstart.html

请这样做:

  • 点击工具> Firebase打开助手窗口。
  • 单击以展开所列功能之一(例如 Analytics),然后单击提供的教程链接(例如 Log an Analytics event)。
  • 点击“连接到 Firebase”按钮以连接到 Firebase 并将必要的代码添加到您的应用。

关于android - 无法解析 ':app@release/compileClasspath' : Could not resolve com. firebase :firebase-client-android:2. 3.1 的依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50559924/

相关文章:

android - 如何更改Android Studio中的编译版本?

android - 在 android 谷歌地图中更改 clustermanager 项目图标

android - 如何将我的其他 Intent 数据发送到拨号器/电话应用程序并在另一个应用程序服务中接收这些 Intent 数据

android - 是否可以创建具有不同大小的子项的 GridView?

java - 如何使用电子邮件登录通过 FirebaseAuth 获取登录到 Android 应用程序的电子邮件帐户用户的照片网址

swift - 如何删除 firebase 和 swift 3 中的单元格和数据

android - 将firebase数据库url(字符串)分配给数据库引用变量?

android - 原始数组大小和 list.size 返回不同的值

java - 我想以编程方式获取 Android 中的应用程序崩溃信息,而不使用第 3 方应用程序或 bugsense 等 jars

android - 无法解析某些类中的符号