我正在将所有测试转换为 Testing Support Library .但是,当我尝试像这样导入 LargeTest
注释时
import android.support.test.filters.LargeTest;
我得到 Cannot resolve symbol 'LargeTest'
。我需要将什么依赖项添加到我的 gradle 文件中才能解决此错误?
最佳答案
你有没有通过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"
}
}
关于android - 无法解析符号 'LargeTest',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38964778/