5

I am converting all of my tests over to the Testing Support Library. However, when I try to import the LargeTest annotation like this

import android.support.test.filters.LargeTest;

I get Cannot resolve symbol 'LargeTest'. What dependency do I need to add to my gradle file to resolve this error?

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268

3 Answers3

1

Have you gone through this documentation?

You need to add some of these dependencies based on your need.

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'
}

And add :

android {
    defaultConfig {
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
}
Shashanth
  • 4,995
  • 7
  • 41
  • 51
DsD
  • 1,081
  • 8
  • 11
  • "Have you gone through this documentation?" Yes. That is the exact page that I linked in my question. And I have all of those dependencies defined and set `testInstrumentationRunner`. – Code-Apprentice Aug 16 '16 at 16:18
1

The filter annotation lives under the following dependency

androidTestCompile 'com.android.support.test:runner:0.5'

If it's still not working please file a bug.

Edit: The issue is that it was introduced in version 0.5 so you have to update your dependency.

Nick Korostelev
  • 325
  • 2
  • 10
0

For AndroidX:

import androidx.test.filters.LargeTest

https://developer.android.com/reference/androidx/test/filters/LargeTest

Gene Bo
  • 11,284
  • 8
  • 90
  • 137