Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Testing in Android UI Testing with Espresso Introducing Espresso

Alexandru Bisa
Alexandru Bisa
4,295 Points

Cannot resolve symbol AndroidJUnit4

Hello,

I'm having issues setting up the @RunWith part, I get a Cannot resolve symbol AndroidJUnit4.

My apps build gradle looks like this:

apply plugin: 'com.android.application'

android { compileSdkVersion 23 buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.teamtreehouse.testingbase"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

configurations.all { resolutionStrategy.force 'com.android.support:support-annotations:23.1.0' }

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.3.0' testCompile "org.mockito:mockito-core:1.+" testCompile 'org.robolectric:robolectric:3.1' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' androidTestCompile 'com.android.support:support-annotations:23.3.0'

}