These two lines must be add to app level gradle debugImplementation "androidx.fragment:fragment-testing:$fragmentVersion" debugImplementation "androidx.test:core:$androidXTestCoreVersion"