我正在尝试将Firebase连接到我的应用程序。 在按下“将Firebase身份验证添加到您的应用程序”后,我收到以下错误:“无法解决:firebase-auth-15.0.0” 这使我想到了build.gradle(module:app)中的依赖项。 错误:
implementation 'com.android.support:appcompat-v7:28.0.0'
有关错误的详细信息:
所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本28.0.0,26.1.0。示例包括com.android.support:animated-vector-drawable:28.0.0和com.android.support:support-media-compat:26.1.0以下...(Ctrl + F1) 有一些库,工具或库的组合不兼容或可能导致错误。一种不兼容的情况是使用不是最新版本的Android支持库版本进行编译(或者特别是低于目标targetSdkVersion的版本)。问题ID:GradleCompatible
我的全部依赖项:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
}
答案 0 :(得分:0)
在您的根目录build.gradle中:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}
在您的模块build.gradle中:
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-auth:16.0.5'
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'