Is there away to set a variable in the build.gradle
file to a value set in the strings.xml
file?
For example say I have this in my strings.xml
file:
<string name="version">"1.0.0"</string>
And in my build.gradle
file I had something along these lines:
versionName: @strings/version
Afaik, as of now it's unavailable to read from string resource files, Android Gradle Plugin does not have such an API.
Instead, you can do the opposite using resValue()
API: you can write a value to resources within build.gradle
:
resValue "string", "variable_name", "some value here"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With