问题描述
我正在尝试在 build.gradle android 扩展的 AndroidManifest.xml 文件中执行替换,但出现此错误:
I'm trying to perform substitution within the AndroidManifest.xml file from the build.gradle android extension but am getting this error:
这是清单文件的片段:
这是 build.gradle 的片段:
And this is a snipped of the build.gradle:
我也尝试在 buildTypes 中添加 manifestPlaceholders,即
I've also tried adding the manifestPlaceholders in the buildTypes i.e.
}
但我仍然遇到同样的错误.
But I still get the same error.
当 manifestPlaceholders 中提供了占位符替换时,为什么会出现需要替换占位符的错误?
Why is there an error about it requiring a placeholder substitution when one is provided for in the manifestPlaceholders?
推荐答案
你只需要添加到数组中.你正在替换它.这样做:
You need to just add to the array. You are replacing it. Do this:
通过为相同的风格/构建类型声明 manifestPlaceholders 两次,您将替换前一个.替换前一个后,您的构建失败,因为该属性不再存在.
By declaring manifestPlaceholders twice for the same flavor/build type, your are replacing the previous one. After the previous one got replaced, your build failed because the property no longer exists.
这篇关于Gradle“清单需要占位符替换"错误但 manifestPlaceholders 提供了一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!