我已将Firebase身份验证链接到我的项目,但仍然不断收到错误消息:
应用gradle文件必须依赖于com.google.firebase:firebase-core for Firebase services to work as intended.
我遵循所有指示仍然没有运气。 请看一下代码,让我知道我还需要添加什么
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.nis.taxiapp1"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-
optimize.txt'), 'proguard-rules.pro'
}
}
}
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.google.firebase:firebase-auth:16.0.3'
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'
}
apply plugin: 'com.google.gms.google-services'
我的项目Gradle代码:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:4.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}`
答案 0 :(得分:2)
错误似乎很清楚,它要求您将firebase-core
库添加到应用程序级别build.gradle
implementation 'com.google.firebase:firebase-core:16.0.7'
有关更多信息,请参阅官方设置指南here。
编辑:16.0.7
是其设置页面上的当前Firebase版本。