android - 无法解析符号 'LargeTest'

标签 android android-studio testing testing-support-library

我正在将所有测试转换为 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/

相关文章:

android - systrace:HTML 输出的跟踪结果格式无效

android - 抽屉导航在状态栏上半透明不起作用

java - 如何只对特定的 Activity 类运行应用程序类?

android - 为什么工具栏没有显示在我的布局中

Android Studio、模拟器、HAXM​​、VT-x 不工作

缺少 Android Studio 导入模块按钮

php - 测试不存在的代码

以 Android 库项目作为外部模块的 Android 应用程序

laravel - 如何测试 laravel 连续作业?

c++ - 使用链表 C++ 的二叉搜索树 (BST) 删除函数的测试用例