Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 484
Rafael Pacheco Avatar asked Mar 18 '23 18:03

Rafael Pacheco


1 Answers

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):

android.library.reference.1=../app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0

Take a look at the documentation.

like image 158
Guilherme Torres Castro Avatar answered Apr 02 '23 14:04

Guilherme Torres Castro