Rafael Pacheco Rafael Pacheco - 6 months ago 78
Android Question

How find support library resources using robolectric?

I'm trying using robolectric to mock somethings on my android app tests. Sadly after I include a external library on my project the tests crashed.
Error info is about some library resource not found.

java.lang.RuntimeException: Could not find any resource from reference ResName{com.company.app:style/Theme_AppCompat_Light_NoActionBar} from style StyleData{name='AppTheme_Base', parent='Theme_AppCompat_Light_NoActionBar'} with theme null

Someone have this problem ?


Libraries that contain internal resources (AKA aar) need to be mapped on project.properties files (at src/main). The file content will be something like this (if you are using Android Studio):


Take a look at the documentation.