Android 无法解析符号';最大的';
我正在将我的所有测试转换为。但是,当我尝试像这样导入Android 无法解析符号';最大的';,android,android-studio,testing,testing-support-library,Android,Android Studio,Testing,Testing Support Library,我正在将我的所有测试转换为。但是,当我尝试像这样导入LargeTest注释时 import android.support.test.filters.LargeTest; 我得到无法解析符号“LargeTest”。我需要向我的gradle文件添加什么依赖项才能解决此错误?您看过文档了吗 您需要根据需要添加其中一些依赖项 dependencies { androidTestCompile 'com.android.support.test:runner:0.4' // Set this
LargeTest
注释时
import android.support.test.filters.LargeTest;
我得到无法解析符号“LargeTest”
。我需要向我的gradle文件添加什么依赖项才能解决此错误?您看过文档了吗
您需要根据需要添加其中一些依赖项
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"
}
}
过滤器注释位于以下依赖项下
androidTestCompile 'com.android.support.test:runner:0.5'
如果仍然不起作用,请提交一份文件
编辑:问题是它是在版本0.5中引入的,因此您必须更新您的依赖项。对于AndroidX:
导入androidx.test.filters.LargeTest
支持注释,也许?@cricket\u 007你是说
androidTestCompile'com.android.Support:Support annotations:24.1.1'
?我已经有了这个…“你看过这个文件了吗?”是的。这正是我在问题中链接的页面。我已经定义并设置了所有这些依赖项testInstrumentationRunner
。