2

I am trying to run an espresso test with release build type for qa purposes, with the configuration suggested on this answer Android Studio Instrumentation testing build variant. The test runs successfuly with the debug build type, but with the release type I get the following error

Warning:there were 118 unresolved references to classes or interfaces.
Warning:there were 8 instances of library classes depending on program classes.
Warning:there were 3 unresolved references to program class members.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.

Error:Execution failed for task ':Offrie:transformClassesAndResourcesWithProguardForQaReleaseAndroidTest'.
> Job failed, see logs for details

Following is the espresso test

@MediumTest
@RunWith(AndroidJUnit4.class)
public class MainActivityInstrumentationTest {

    @Rule
    public ActivityTestRule<MainActivity> activityRule
            = new ActivityTestRule<>(
            MainActivity.class,
            true,
            false);

    @Test
    public void shouldShowNotificationContentWhenActivityIsDestroyed() {
        final String NOTIFICATION_TITLE = "Título";
        final String NOTIFICATION_CONTENT = "Texto";

        Intent intent = buildNotificationIntent(NOTIFICATION_TITLE, NOTIFICATION_CONTENT);

        activityRule.launchActivity(intent);

        onView(withId(R.id.notification_title)).check(matches(allOf(withText(NOTIFICATION_TITLE), isDisplayed())));
        onView(withId(R.id.notification_content)).check(matches(allOf(withText(NOTIFICATION_CONTENT), isDisplayed())));
    }

    @NonNull
    private Intent buildNotificationIntent(String NOTIFICATION_TITLE, String NOTIFICATION_CONTENT) {
        Intent intent = new Intent();

        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.putExtra(NotificationsUtils.NOTIFICATION_TITLE_PARAMETER, NOTIFICATION_TITLE);
        intent.putExtra(NotificationsUtils.NOTIFICATION_TEXT_PARAMETER, NOTIFICATION_CONTENT);
        return intent;
    }

And these are two screenshots of the output

enter image description here

enter image description here

How can I solve this dependency issue?

Community
  • 1
  • 1
Nicolás Arias
  • 1,053
  • 1
  • 12
  • 29
  • This looks like a proguard issue and does not have anything to do with Espresso. Also, you should copy and paste the error messages, not post screenshots. – Code-Apprentice Feb 15 '17 at 15:43

0 Answers0