Error android.content.res.Resources$NotFoundException: String resource ID

Error on buildActivity() call of Robolectric. It is getting manifest file correctly but getting an error "android.content.res.Resources NotFoundException: String resource ID 0x7f0b2de8".

Setup : Android Studio 2.3.3 on windows and robolectric-compile 'org.robolectric:robolectric:2.4' and gradle plugin, Android plugin 2.3.2 and GradleVersion 4.4

Tried option "android.enableAapt2=false" in gradle.properties file but is of no use.

@RunWith(RobolectricTestRunner.class)

@Config(manifest="src/main/AndroidManifest.xml", emulateSdk = 18)

public class SignalMonitorActivityTest {

private SignalMonitorActivity objActivity;

private ActivityController controller;

@Before

public void setUp() throws Exception {

//Robolectric.setupActivity(SignalMonitorActivity.class);

controller = Robolectric.buildActivity(SignalMonitorActivity.class).create();

controller.start();

controller.visible();

controller.resume();

}

Error :

WARNING: no system properties value for ro.build.date.utc

DEBUG: Loading resources for com.ABC.android.com_common_Configuration from .\src\main\res...

android.content.res.Resources$NotFoundException: String resource ID #0x7f0b2de8

at android.content.res.Resources.getText(Resources.java:239)

at org.robolectric.shadows.ShadowResources.getText(ShadowResources.java:363)

at android.content.res.Resources.getText(Resources.java)

at android.content.res.Resources.getString(Resources.java:325)

at...

Read More »

By: StackOverFlow - Wednesday, 9 January

Related Posts