Remove @NotNull annotation from ResName() constructor, which was causing an IllegalStateException:-

Caused by: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'type' of org/robolectric/res/ResName.<init> must not be null
	at org.robolectric.res.ResName.<init>(ResName.java)
	at org.robolectric.res.ResName.qualifyResName(ResName.java:54)
	at org.robolectric.res.ResName.qualifyResourceName(ResName.java:39)
	at org.robolectric.res.ResName.getResourceId(ResName.java:68)

This seems to be caused because ResName.java:68 there is a call to

... = qualifyResourceName(possiblyQualifiedResourceName, contextPackageName, null);

Note that the third parameter defaultType is null, this is passed all the way down to the call to the ResName() constructor for the "type"
parameter as

type == null ? defaultType : type,

so, if both type and defaultType are null, then the check NPEs.

Also, add a check to enable debugging when if a resource can not be resolved from its name we throw an IllegalArguementException detailing
the name of the resource rather than NPE.