无法应用插件“com.google.gms.google-services” [英] Failed to apply plugin "com.google.gms.google-services"
本文介绍了无法应用插件“com.google.gms.google-services”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的项目 build.gradle :
Here is my project build.gradle:
buildscript {
...
dependencies {
...
classpath 'com.google.gms:google-services:3.1.0'
}
}
在模块的 build.gradle 之一中,我有这个:
In one of the module's build.gradle I have this:
apply plugin: 'com.google.gms.google-services'
会导致以下错误:
which results into the following error:
Could not get unknown property 'LibraryVariants' for object of type com.android.build.gradle.LibraryExtension.
有趣的是,如果我设置 google-services
版本到 3.0.0
,这个特定的错误消失了,但Gradle要我降级其他谷歌库的版本,但我真的不想这样做。
Fun fact, if I set google-services
version to 3.0.0
, this specific error disappears, but Gradle asks me to downgrade versions of other google libraries, but I really do not want to do that.
如何处理这些 LibraryVariants
?
推荐答案
您只在应用模块中设置 apply plugin:'com.google.gms.google-services'
并没有其他模块。
You only set apply plugin: 'com.google.gms.google-services'
in the app module, and in no other modules.
这篇关于无法应用插件“com.google.gms.google-services”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文