Michael de Silva's Blog

Software Engineer. Rubyist and Roboticist.

Michael de Silva's Blog

Software Engineer. Rubyist and Roboticist.

Instrumenting Android UI with Espresso and AndroidJUnitRunner

August 2016, and I cannot believe the number of hoops I had to jump through, and several hours of Googling just to be able to Setup Espresso in Android Studio.

The bit that I needed was to perform a certain exclusion,

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2')
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support:support-annotations:24.2.0'
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.0') {
    exclude group: 'com.android.support', module: 'support-v4'
}

Works great with an API 23 app I'm working on for a client. Just make sure that you add testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" into your app/build.gradle's defaultConfig block.

comments powered by Disqus