我正在将我所有的测试转换到Testing Support Library上。但是,当我尝试像这样导入LargeTest
注释时,
import android.support.test.filters.LargeTest;
我得到了Cannot resolve symbol 'LargeTest'
。我需要向gradle文件添加什么依赖项才能解决此错误?
发布于 2016-08-16 10:31:31
你看过this文档了吗?
您需要根据需要添加其中的一些依赖项。
dependencies {
androidTestCompile 'com.android.support.test:runner:0.4'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.4'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Set this dependency to build and run UI Automator tests
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}
并添加:
android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
发布于 2016-10-11 13:38:16
筛选器注释位于以下依赖项下
androidTestCompile 'com.android.support.test:runner:0.5'
如果它仍然不能工作,请提交bug。
编辑:问题是它是在0.5版本中引入的,所以你必须更新你的依赖项。
发布于 2021-04-17 03:16:10
对于AndroidX:
import androidx.test.filters.LargeTest
https://developer.android.com/reference/androidx/test/filters/LargeTest
https://stackoverflow.com/questions/38964778
复制相似问题