我有以下依赖关系:
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile('com.android.support.test.espresso:espresso-intents:2.2') {
// Necessary if your app targets Marshmallow (since Espresso
hasn't moved to Marshmallow yet)
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile('com.android.support.test:runner:0.3') {
// Necessary if your app targets Marshmallow (since the test runner
hasn't moved to Marshmallow yet)
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile('com.android.support.test:rules:0.3') {
exclude group: 'com.android.support', module: 'support-annotations'
}
//ui automator test dependency
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
androidTestCompile 'com.squareup.spoon:spoon-client:1.6.4'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
androidTestCompile 'com.android.support:support-annotations:25.3.1'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile('junit:junit:4.10') {
exclude module: 'hamcrest-core'
}
androidTestCompile 'org.hamcrest:hamcrest-all:1.3'
但是当我导入测试包时,我将测试为无法解决符号测试错误。
导入android.support。 测试 .InstrumentationRegistry;
import android.support。 test .espresso.ViewInteraction;
import android.support。 test .filters.SdkSuppress;
import android.support的 测试 .rule.ActivityTestRule;
这有什么解决方案吗?提前谢谢。
答案 0 :(得分:0)
这是我的测试依赖,试试吧
//Test
dependencies{
androidTestCompile 'junit:junit:4.12'
androidTestCompile "com.android.support.test:runner:$testRulesVersion"
androidTestCompile "com.android.support.test:rules:$testRulesVersion"
androidTestCompile("com.android.support.test.espresso:espresso-
core:$espressoVersion", {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile "com.android.support.test.espresso:espresso-
intents:$espressoVersion"
androidTestCompile "com.android.support.test.espresso:espresso-
web:$espressoVersion"
}
版本
ext {
testRulesVersion = '0.5'
espressoVersion = '2.2.2'
}