I am working on some reusable Android code that I would like to distribute to other developers for use within their own applications. The code has some resource dependencies
I was using user558185 solution but here is a more simple way. If you resources is in a library project (for a Cordova Plugin for example), you can get resource with context.getResources().getIdentifier(name, className, context.getPackageName());
This happen when the library project resources R file is not generated properly and the R packageName did not match the required packageName by the library project.
The usage is the same as user558185 answer, but it use a native Android method.