与摇篮,Android的插件过滤器的strings.xml?过滤器、摇篮、插件、xml

2023-09-05 01:32:10 作者:香烟陪伴青春

如何筛选我RES /价值/ strings.xml中的文件?

How would I filter my res/values/strings.xml file?

是这样的:

<resources>
    <string name="version_name">${version}</string>
...

$ {版本} 将扩大到版本从build.gradle文件中的值

The ${version} would be expanded to the value of version from the build.gradle file

推荐答案

通过常规闭合,如果你没有preFER蚂蚁外部:

With groovy closure, if you prefer without ant external:

filter {
    line -> line.replace('${version}', version)
}