Espresso Read String File Value
You should use InstrumentationRegistry.getContext()
instead of InstrumentationRegistry.getTargetContext()
and then use appropriate package for generated R file (by default it will append .test
to your package):
Resources resources = InstrumentationRegistry.getContext().getResources();
String name = resources.getString(com.your_package.test.R.string.product_name);
Pay attention to test
part in resource name.