You can force the annotation library in your test using:
androidTestCompile 'com.android.support:support-annotations:23.1.0'
Something like this:
// Force usage of support annotations in the test app, since it is internally used by the runner module.
androidTestCompile 'com.android.support:support-annotations:23.1.0'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.1'
Another solution is to use this in the top level file:
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.1.0'
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…