android - google-services 和 android-gms 之间的版本冲突

标签 android

我有这样的模块 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?

SDK 工具是 enter image description here

最佳答案

正如 OP 所提到的那样

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

必须移至应用模块构建 gradle 文件的底部。此行应位于所有 google gms 依赖项之后。

关于android - google-services 和 android-gms 之间的版本冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47548962/

相关文章:

Android Studio 从 Activity 中更改 TextView fragment

java - okhttp validator 是否处理 403 错误?

android - 如何获取可用网络提供商的列表?

android - 如何定时轰炸 Android 应用程序?

java - 如何制作在 Lollipop 设备上设计的 PreferenceActivity Material ?

android - 定期检查android GPS是否有新数据

java - 如何在Android Studio上设置四个图片在不同的角落?

android - 找不到资源异常R.string

android - ViewFlipper中的VideoView在播放视频时是透明的

android - 苔丝二找不到 libpng.so