Android 使用版本生成类型运行espresso测试时未解析的引用
我正在尝试运行一个版本构建类型的espresso测试,用于qa目的,配置建议如下。测试使用调试生成类型成功运行,但是使用发布类型我得到以下错误Android 使用版本生成类型运行espresso测试时未解析的引用,android,android-espresso,Android,Android Espresso,我正在尝试运行一个版本构建类型的espresso测试,用于qa目的,配置建议如下。测试使用调试生成类型成功运行,但是使用发布类型我得到以下错误 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 unreso
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
以下是浓缩咖啡测试
@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;
}
@MediumTest
@RunWith(AndroidJUnit4.class)
公共类MainActivityInstrumentationTest{
@统治
公共活动测试规则活动规则
=新的ActivityTestRule(
main.class,
是的,
假);
@试验
当活动被销毁时,public void应显示通知内容(){
最终字符串通知_TITLE=“Título”;
最终字符串通知\u CONTENT=“Texto”;
意图=构建通知意图(通知标题、通知内容);
activityRule.启动活动(意图);
onView(带id(R.id.notification_title))。检查(匹配(allOf(带text(notification_title))isDisplayed());
onView(带id(R.id.notification_content))。检查(匹配(allOf(带text(notification_content)),isDisplayed());
}
@非空
私有意图buildNotificationIntent(字符串通知\标题、字符串通知\内容){
意图=新意图();
intent.addFlags(intent.FLAG\u ACTIVITY\u CLEAR\u TOP);
intent.putExtra(NotificationsUtils.NOTIFICATION_TITLE_参数,NOTIFICATION_TITLE);
intent.putExtra(NotificationsUtils.NOTIFICATION_TEXT_参数,NOTIFICATION_内容);
返回意图;
}
这是输出的两个屏幕截图
如何解决此依赖性问题?这看起来像是一个proguard问题,与浓缩咖啡无关。此外,您应该复制并粘贴错误消息,而不是发布屏幕截图。