我正在尝试使用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 Firebase
compile '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'
答案 0 :(得分:1)
无法解决:com.google.android.support.gms:play-services-map:10.2.0
它发生是因为它不存在:
使用:
compile 'com.google.android.gms:play-services-maps:x.x.x'
而不是
compile 'com.google.android.support.gms:play-services-map:10.2.0'
在build.gradle的任何情况下,你都需要改变一些东西:
例如,使用最新的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'
更新您的compileSdkVersion
使用firebase-ui
库的 compatibile version 。
删除文件顶部的apply plugin: 'com.google.gms.google-services'
。