Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Not compiling test class with a fragment that not inherits directly but indirectly from Fragment class

Đang mở
#503 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
android, kotlin
Lĩnh vực
mobile-dev, testing

Hướng nghiên cứu

Bắt đầu với điểm vào FiltersFragmentTest và các khai báo dependency của module; tái hiện việc biên dịch launchFragmentInContainer và kiểm tra các phiên bản androidx.fragment đã được phân giải. Xác nhận liệu test có biên dịch khi Fragment được kế thừa gián tiếp hay không, đồng thời ghi lại trạng thái dependency/phiên bản quyết định kết quả.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I'm working with this code:

@RunWith(AndroidJUnit4ClassRunner::class)
class FiltersFragmentTest {

    @Test
    fun fragmentIsVisible() {
        val scenario = launchFragmentInContainer<FiltersFragment>()
        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

Ngôn ngữ chính
Java
Star
9.3k
Fork
3.6k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của android/testing-samples

Tất cả issue của android/testing-samples

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.