使用Google服务 编译时遇到的问题

问题

  • What went wrong:
    Execution failed for task ‘:app:processXXXXDebugGoogleServices’.

    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.

  • Try:
    Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 16s

解决办法:

可能是因为引用的库中有其他库也引用了Google服务,并且版本还不一样,AS的插件解析也问题吧
把build.gradle 中 apply plugin: 'com.google.gms.google-services'
放到文件最后

dependencies {
    implementation "com.android.support:appcompat-v7:27.1.1"
    implementation "com.android.support:recyclerview-v7:27.1.1"
    implementation "com.google.android.gms:play-services-ads:15.0.0"
    implementation "com.google.android.gms:play-services-analytics:15.0.0"
    implementation "com.google.android.gms:play-services-cast-framework:15.0.0"
    ...
}
apply plugin: 'com.google.gms.google-services'

猜你喜欢

转载自blog.csdn.net/moxiouhao/article/details/80620401