通过跟随Firebase的助手(AndroidStudio:工具> Firebase),我尝试将Firebase AUthentication添加到我的应用中。 但是在设置依赖项后,Gradle项目同步失败,并出现如下错误。 我正在努力解决此问题...任何人都可以帮助我吗?
在项目“应用”中,已解决的Google Play服务库依赖性 取决于另一个版本的确切版本(例如“ [15.0。1]”,但不是 被解析为该版本。图书馆展示的行为将 未知。依赖项失败: com.google.android.gms:play-services-flags:15.0.1-> com.google.android.gms:play-services-basement @ [ 15.0.1],但play-services-basement版本为16.0.1。以下依赖项是直接或具有的项目依赖项 传递依赖关系导致了问题的解决。 -项目“应用”取决于com.google.firebase:firebase-firestore@17.1.4 -项目“应用”取决于com.google.firebase:firebase-database@16.0.5 -项目“应用”取决于com.google.firebase:firebase-auth@16.0.1 -项目'app'取决于com.firebaseui:firebase-ui-auth@4.1.0有关扩展的调试信息,请从命令行使用以下命令执行Gradle ./gradlew --info:app:assembleDebug以查看到的dep endency路径 神器。此错误消息来自google-services Gradle 插件,在https://上报告问题 github.com/google/play-services-plugins并通过添加禁用 “ googleServices {disableVersionCheck = false}”到您的build.gradle 文件。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Define versions in a single place
ext {
roomVersion = '1.1.1'
archLifecycleVersion = '1.1.1'
supportLibraryVersion = '26.1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.poc.android.myhospitals"
minSdkVersion 21
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'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
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.android.support:recyclerview-v7:27.1.1'
implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion"
// Firebase
implementation 'com.google.firebase:firebase-firestore:17.1.4'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
// Room components
implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
// Lifecycle components
implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"
implementation "android.arch.lifecycle:viewmodel:1.1.1"
implementation 'com.jakewharton.timber:timber:4.7.1'
}
答案 0 :(得分:2)
我认为这行有问题
实现'com.google.firebase:firebase-auth: 16.0.1:15.0.0 '
应该是这样
实现'com.google.firebase:firebase-auth: 16.0.1 '
建议:
从每个Firebase库中排除支持模块
implementation('com.google.firebase:firebase-core:16.0.6') {
exclude group: 'com.android.support', module: 'support-v4'
}