android / android/testing-samples
Not compiling test class with a fragment that not inherits directly but indirectly from Fragment class
- 主要语言
- Java
- 星标
- 9.3k
- 派生
- 3.6k
- PR 合并指标
- 30 天内没有已合并 PR
描述
I'm working with this code:
```
@RunWith(AndroidJUnit4ClassRunner::class)
class FiltersFragmentTest {
@Test
fun fragmentIsVisible() {
val scenario = launchFragmentInContainer()
scenario.recreate()
Espresso
.onView(ViewMatchers.withId(R.id.jvQuery))
.check(matches(isDisplayed()))
}
}
```
The FiltersFragment class inherits from a class custom, that inherits from another custom base fragment class that inherits from Fragment (androidx.fragment.app.Fragment). But when trying to execute the test an error is shown in compile time
Cannot access class 'androidx.fragment.app.FragmentFactory'. Check your module classpath for missing or conflicting dependencies
Type argument is not within its bounds: should be subtype of 'Fragment'
I see in my project dependencies two versions of fragment library: 1.3.6 for appCompat library use and direct dependency 1.6.2
Both have FragmentFactory class inside
贡献指南
调研方向
从 FiltersFragmentTest 入口点和模块依赖声明开始;重现 launchFragmentInContainer 的编译,并检查已解析的 androidx.fragment 版本。确认当 Fragment 被间接继承时测试是否能够编译,并记录决定结果的依赖/版本状态。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, kotlin
- 领域
- mobile-dev, testing
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100