我正在尝试将Firebase添加到现有项目。您可以在此处查看完整的项目:https://github.com/UdacityAndroidDevScholarship/blood-donation
我已经添加了所有Firebase SDK。在gradle.build项目中,我已将classpath 'com.google.gms:google-services:4.3.2'
添加到gradle.build项目中。
但是当我添加implementation 'com.google.firebase:firebase-analytics:17.2.0'
时
应用gradle.build我遇到以下错误
错误:在项目“应用”中,一个已解析的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版本为17.0.0。
以下依赖项是直接或直接的项目依赖项 具有传递依赖,从而导致与 问题。 -项目“应用”取决于com.google.android.gms:play-services-measurement @ {严格地17.2.0} -项目“应用”取决于com.google.firebase:firebase-database-collection @ {严格地15.0.1} -项目“应用”取决于com.google.android.gms:play-services-maps@15.0.0 -项目“应用”取决于com.google.android.gms:play-services-maps @ {严格地15.0.0}
有关扩展调试信息,请从命令行使用以下命令执行Gradle ./gradlew --info:app:assembleDebug以查看到的dep endency路径 神器。此错误消息来自google-services Gradle 插件,在https://上报告问题 github.com/google/play-services-plugins并通过添加禁用 “ googleServices {disableVersionCheck = false}”到您的build.gradle 文件。
这是我的应用gradle.build
apply plugin: 'com.android.application'
android {
compileSdkVersion buildConfig.compileSdk
defaultConfig {
applicationId "com.udacity.nanodegree.blooddonation"
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.targetSdk
versionCode buildConfig.version.code
versionName buildConfig.version.name
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
buildTypes.each {
it.resValue('string', "google_maps_key", propOrThrow('GOOGLE_MAPS_API_KEY'))
}
}
lintOptions {
textReport true
textOutput 'stdout'
lintConfig rootProject.file('lint.xml')
checkDependencies true
checkTestSources true
explainIssues false
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Support lib
implementation deps.android.support.appcompatV7
// Support Design
implementation deps.android.support.design
// Constraint layout
implementation deps.android.support.constraintLayout
//FireBase Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.0'
// Firebase Auth
implementation deps.google.firebase.auth
// Realtime database
implementation deps.google.firebase.database
//Country code picker
// https://android-arsenal.com/details/1/5753 // TODO: move to project level gradle
implementation 'com.github.joielechong:countrycodepicker:2.1.5'
// Leak canary
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
debugImplementation deps.square.leackcanary.debug
releaseImplementation deps.square.leackcanary.release
// Timber - Logging library
implementation deps.other.timber
// Fused location
implementation deps.google.play_services.location
// Geo-fire
implementation deps.google.firebase.geo_fire
// Map
implementation deps.google.play_services.maps
// PinView // TODO: move to project level gradle
implementation 'com.github.GoodieBag:Pinview:v1.3'
implementation deps.google.gson.gson
implementation deps.google.firebase.cloud_messaging
testImplementation deps.junit
androidTestImplementation deps.android.support.test.runner
androidTestImplementation deps.android.support.test.espressoCore
}
apply plugin: 'com.google.gms.google-services'
但是我删除implementation 'com.google.firebase:firebase-analytics:17.2.0'
时,错误消失了。但是问题是Firebase控制台上没有分析功能。我知道有重复的依赖项。但是我不希望删除或修改。请帮助