I\'m trying to add Espresso 2 to my project (which also has lots of other dependencies), but I\'m hitting this error when trying to run tests:
UNEXPECTED TOP
One other useful tip is how to force dependency resolution to a specific version.
Here is one way:
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:22.0.0'
}
...and here is another:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.android.support') {
details.useVersion '22.0.0'
}
}
}
Using either of these with com.android.support.test.espresso:espresso-core:2.1 should work.
See the Forcing consistent version for a group of libraries section in the Gradle documentation for more information.