I found the error. It turns out that Robolectric does not support the item tag for resources declared in XML. My resources were declared as
<item type="bool" name="isRelease">false</item>
<item type="integer" name="act_noNetwork">12345</item>
However, the Robolectric XML parser just checks for bool
nodes, and not for item
nodes, when parsing booleans. The same goes for integers, I haven't checked other types. I changed my declarations to:
<bool name="isRelease">false</bool>
<integer name="act_noNetwork">12345</integer>
Now Robolectric parses the resources correctly. Note that both ways seem to be equally valid in the normal Android runtime. I didn't check the official docs if there is any recommendation though.