我有这样的模块 gradle 依赖项
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:11.6.2'
implementation 'com.google.firebase:firebase-messaging:11.6.2'
implementation 'com.google.android.gms:play-services-gcm:11.6.2'
implementation 'com.google.android.gms:play-services-ads:11.6.2'
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'
}
和这样的gradle项目
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.2'
}
当我将我的项目与 gradle 同步时,出现执行失败错误
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.4.2.
但是为什么?我的目标 SDK 为 27,我到处都可以设置为使用最新的软件包,为什么工作室要求我将 com.google.android.gms 降级到 11.4.2?
最佳答案
正如 OP 所提到的那样
apply plugin: 'com.google.gms.google-services'
必须移至应用模块构建 gradle 文件的底部。此行应位于所有 google gms 依赖项之后。
关于android - google-services 和 android-gms 之间的版本冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47548962/