I have a variable in build.gradle
(Module: app) which counts the build number (number of compilations to be precise:
String content = ""
def buildCountFile = new File("c:\\projects\\aviacheck\\spec\\aviacheck-build-counter.txt")
if (buildCountFile.exists()) {
content = buildCountFile.getText('UTF-8')
}
int count = 0;
if (content.isNumber()) {
count = content.toInteger() + 1;
}
buildCountFile.write(count.toString())
// build counter ends
buildTypes {
debug{
resValue "string", "bNr", count.toString()
}
release {
resValue "string", "bNr", count.toString()
}
}
which is stored in "bNr".
Of course I can use it in code by getResoures()
, but I would like to concatenate it in strings.xml
with one more string without writing code.
So, defining version compilation like that:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE resources [
<!ENTITY appVer "1.2">
]>
<resources>
// ........
<string name="ver">"&appVer; Build: &bNr;</string>
// ........
</resources>
Unfortunately, &bNr
remains unresolved.
Any ideas on what the problem could be?
I would like to concatenate it in strings.xml with one more string without writing code
That is not supported, sorry.
unfortunately &bNr keeps unresolved.
There is no HTML entity by that name.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.