问题描述
我正在尝试更新Google服务插件,但在Gradle同步期间收到错误消息:项目刷新失败:错误:找不到匹配项"
I am attempting to update Google Services Plugin but receive an error during Gradle sync:"Project Refresh Failed: Error: No Match Found"
在3.1.1版中一切正常,但是只要将build.gradle更新为:
Everything works fine with Version 3.1.1 but as soon as I update the build.gradle to:
classpath 'com.google.gms:google-services:3.2.0'
发生错误.
我检查了idea.log的错误提示,可以看到抛出了异常,但是我真的不知道为什么.似乎被一个名为"getJsonLocations
"的方法抛出了,该方法在3.2.0中似乎是新的,如下图所示.
I checked the idea.log as the error suggested and can see that an exception is being thrown but I really do not know why. It seems to get thrown at a method named "getJsonLocations
" which seems to be new in 3.2.0 as shown in the image below.
有人知道如何解决吗?
推荐答案
似乎productFlavours
现在必须以小写字母开头,此插件才能正常工作.使用大写字母会引发问题中显示的异常.
It seems that productFlavours
must now start with a lower case letter for this plugin to work. Using a capital letter throws the exception shown in the question.
我没有记录此限制.
productFlavors {
// Works fine
notDemo {
applicationIdSuffix ".notDemo"
versionNameSuffix "-notDemo"
}
// Not valid because it starts with a capital letter
Demo {
applicationIdSuffix ".demo"
versionNameSuffix "-demo"
}
}
已报告: https://issuetracker.google.com/issues/72581499
这篇关于Google Service Plugin 3.2.0导致Gradle构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!