无法解决(com.google.android.support.gms:play-services-map:10.2.0)

沉舟侧畔千帆进,病树前头万木春。这篇文章主要讲述无法解决:com.google.android.support.gms:play-services-map:10.2.0相关的知识,希望能为你提供帮助。
我正在尝试使用Google的功能来创建谷歌地图,但当我尝试同步项目时,我收到了此错误
这是build.gradle文件..

apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services'android {compileSdkVersion 24 buildToolsVersion "24.0.2" defaultConfig { applicationId "com.example.chamiya.bustracking" minSdkVersion 16 targetSdkVersion 24 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }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' })// can update the Firebasecompile 'com.google.android.gms:play-services:11.4.2' compile 'com.android.support:cardview-v7:24.2.1' compile 'com.android.support:recyclerview-v7:24.2.1' compile 'com.google.firebase:firebase-database:10.2.0' compile 'com.google.firebase:firebase-auth:10.2.0' compile 'com.firebaseui:firebase-ui-auth:1.2.0' compile 'com.firebaseui:firebase-ui-database:1.2.0' compile 'com.android.support:appcompat-v7:24.2.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.google.android.support.gms:play-services-map:10.2.0' testCompile 'junit:junit:4.12'} apply plugin: 'com.google.gms.google-services'

答案
无法解决:com.google.android.support.gms:play-services-map:10.2.0
它发生是因为它不存在:
使用:
compile 'com.google.android.gms:play-services-maps:x.x.x'

【无法解决(com.google.android.support.gms:play-services-map:10.2.0)】代替
compile 'com.google.android.support.gms:play-services-map:10.2.0'

无论如何,在build.gradle中你必须改变一些东西:
  1. 您必须使用相同版本的支持firebase库和Google Play服务库。
例如,使用最新的v11.8.0
compile 'com.google.android.gms:play-services:11.X.X' compile 'com.google.firebase:firebase-database:11.x.x' compile 'com.google.firebase:firebase-auth:11.x.x' compile 'com.google.android.support.gms:play-services-map:11.x.x'

  1. 更新你的compileSdkVersion
  2. 使用compatibile version库的firebase-ui
  3. 删除文件顶部的apply plugin: 'com.google.gms.google-services'

    推荐阅读