我是Roboelectric测试的新手。 我正在尝试关注this帖子来测试片段。我使用以下作为依赖
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile "org.robolectric:robolectric:3.0"
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:support-v4:22.1.0'
compile 'com.google.android.gms:play-services:7.5.0'
}
但是这个导入给了我编译问题,我无法解决符号SupportFragmentTestUtil的问题。请指导我,我错过了什么?
org.robolectric.shadows.support.v4.SupportFragmentTestUtil
答案 0 :(得分:11)
您需要为v4阴影支持添加依赖项。在依赖文件中添加它。
testCompile "org.robolectric:shadows-support-v4:3.0"