位置和firebase一起不起作用

时间:2017-07-31 14:55:52

标签: android firebase

对于FireBase,我需要在build.gradle(Module:app)中写下以下行:

apply plugin: 'com.google.gms.google-services'

但是当我写这篇文章时,我收到以下错误消息:

Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.0.2.

当我删除或评论这两行时:

compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'

我没有收到任何错误消息,但我无法使用位置功能。<​​/ p>

依赖关系:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/jsch-0.1.54.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/dropbox-android-sdk-1.6.3.jar')

compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.github.chrisbanes:PhotoView:1.2.6'
compile 'com.android.support:design:25.3.1'
//compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-analytics:9.0.2'
compile 'com.google.firebase:firebase-config:9.0.2'
compile 'com.google.firebase:firebase-auth:9.0.2'
testCompile 'junit:junit:4.12'
}
//last line:
apply plugin: 'com.google.gms.google-services'

任何人都可以帮助解决这场冲突的解决方案吗?

提前致谢。

1 个答案:

答案 0 :(得分:0)

你必须使你的所有firebase和google play都是相同的版本

例如

compile 'com.google.android.gms:play-services-location:11.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.firebase:firebase-analytics:11.0.2'
compile 'com.google.firebase:firebase-config:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'