I have found a bug in android_set_version_name.
If there is a space in the version name, for example:
"3.2.1 some word"
only the last set of characters after the last space are replaced. So if I were to try to set the version name to "3.2.2 another word" the actual version name in the gradle file will be:
"3.2.1 some 3.2.2 another word"