第三章:使用Android Studio导入UIAutomator与Espresso的jar包

1.在build.gradle中添加依赖:

dependencies {

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

androidTestCompile 'com.android.support.test:rules:0.2'

androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0'

androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'

}

2.然后添加

defaultConfig {

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

3.添加完成后,总会碰到

Error:Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (25.2.0) and test app (23.2.1) differ

这样的版本冲突问题,很头疼,解决办法,在android{}中添加:

configurations.all {

resolutionStrategy.force"com.android.support:support-annotations:23.2.1"

}

之后才能解决~目前遇到的就是这样的问题了,如果以后还有就继续补充~

你可能感兴趣的:(第三章:使用Android Studio导入UIAutomator与Espresso的jar包)