【发布时间】:2018-09-16 02:46:26
【问题描述】:
使用依赖项时,在 google-services 插件 或 com.google.android.gms 上显示错误。如何解决此问题???
build.gradle(模块应用)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'
implementation 'com.twotoasters.jazzylistview:library:1.2.1'
implementation 'com.google.android.gms:play-services-ads:12.0.1'
//here its shows an error
请通过更新 google-services 插件的版本(有关最新版本的信息可在 https://bintray.com/android/android-tools/com.google.gms.google-services/ 获得)或更新 com.google 的版本来解决版本冲突.android.gms 到 12.0.1。
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-messaging:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
build.gradle(项目 XYZ)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
// classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.google.gms:google-services:3.2.0' // google-services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
【问题讨论】: