将 android studio 项目与 Firebase 集成以实现谷歌登录功能时出现依赖错误 [英] Dependancy error when integrating android studio project with Firebase for a google sign in feature

查看:10
本文介绍了将 android studio 项目与 Firebase 集成以实现谷歌登录功能时出现依赖错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Kotlin 中开发一个应用程序并不断收到错误消息:

<块引用>

无法解决:firebase-auth-15.0.0`

尝试同步 gradle 时.我正在尝试实施 Google 登录功能.

应用插件:'com.android.application'应用插件:'kotlin-android'应用插件:'kotlin-android-extensions'应用插件:'com.google.gms.google-services'安卓 {compileSdkVersion 28默认配置{applicationId "nus.is3261.kotlinapp"minSdk 版本 21目标SDK版本28版本代码 1版本名称1.0"testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"}构建类型{释放 {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}}依赖{实现文件树(目录:'libs',包括:['*.jar'])实现org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"实现 'com.android.support:appcompat-v7:28.0.0'实现 'com.android.support.constraint:constraint-layout:1.1.3'实现 'com.android.support:support-v4:28.0.0'实现 'com.android.support:design:28.0.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'实现 'com.google.firebase:firebase-auth:16.0.1:15.0.0'}

我已尝试在此处遵循有关堆栈溢出的解决方案,但我在同步 gradle 后留下了这个警告 警告:应用程序 gradle 文件必须依赖于 com.google.firebase:firebase-core 才能使 Firebase 服务按预期工作.>

解决方案

您收到以下错误:

<块引用>

无法解决:firebase-auth-15.0.0

因为您在代码中使用了错误的依赖项.要解决此问题,请更改以下代码行:

实现'com.google.firebase:firebase-auth:16.0.1:15.0.0'

实现 'com.google.firebase:firebase-auth:16.0.5'

因为这样的版本16.0.1:15.0.0不存在.

还请添加以下现在必须的依赖项:

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

<块引用>

您的应用 gradle 文件现在必须明确列出 com.google.firebase:firebase-core 作为 Firebase 服务按预期工作的依赖项.

在您的顶级 build.gradle 文件中,请确保拥有最新版本的 Google 服务插件:

classpath 'com.google.gms:google-services:4.1.0'

I'm developing an app in Kotlin and keep getting the error:

Failed to resolve: firebase-auth-15.0.0`

when trying to sync gradle. I'm trying to implement a google sign in feature.

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "nus.is3261.kotlinapp"
    minSdkVersion 21
    targetSdkVersion 28
    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'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.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-auth:16.0.1:15.0.0'

}

I have tried to follow the solution on stack overflow here, but I am left with this warning after syncing gradle Warning: The app gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended.

解决方案

You are getting the following error:

Failed to resolve: firebase-auth-15.0.0

Because you are using a wrong dependency in your code. To solve this, please change the following line of code:

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

to

implementation 'com.google.firebase:firebase-auth:16.0.5'

Because such a version 16.0.1:15.0.0 does not exist.

Please also add the following dependency which is now mandatory:

implementation 'com.google.firebase:firebase-core:16.0.4'

Your app gradle file now has to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.

In your top level build.gradle file please be sure to have the latest version of Google Service plugin:

classpath 'com.google.gms:google-services:4.1.0'

这篇关于将 android studio 项目与 Firebase 集成以实现谷歌登录功能时出现依赖错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆