【发布时间】:2020-05-23 22:31:54
【问题描述】:
我正在尝试在我的 android 应用程序中为回收站视图编写测试。我收到“RecyclerViewActions”和“RecyclerViewMatcher”的无法解析符号错误。
这是我的测试中抛出“无法解析符号”错误的辅助方法。
````// Convenience helper
public static RecyclerViewMatcher withRecyclerView(final int recyclerViewId) {
return new RecyclerViewMatcher(recyclerViewId);
}````
这是我的导入,错误也被抛出
import static androidx.test.espresso.contrib.RecyclerViewActions;
这是我的应用级 build.gradle 依赖项:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment:2.0.0'
implementation 'androidx.navigation:navigation-ui:2.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.2.0') {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
}
}````
【问题讨论】: