Abhimanyu
01/12/2025, 7:36 AMGiven component holder class androidx.activity.ComponentActivity does not implement interface dagger.hilt.internal.GeneratedComponent or interface dagger.hilt.internal.GeneratedComponentManager
Please help thank you colorAbhimanyu
01/12/2025, 7:37 AMimport androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.navigation.compose.ComposeNavigator
import androidx.navigation.testing.TestNavHostController
import org.junit.Assert
import org.junit.Before
import org.junit.Rule
import org.junit.Test
internal class MyNavHostTest {
@get:Rule
val composeTestRule = createComposeRule()
private lateinit var navHostController: TestNavHostController
@Before
fun setupAppNavHost() {
composeTestRule.setContent {
navHostController = TestNavHostController(
context = LocalContext.current,
)
navHostController.navigatorProvider.addNavigator(
navigator = ComposeNavigator(),
)
MyNavHost(
navHostController = navHostController,
)
}
}
@Test
fun startDestinationIsHome() {
Assert.assertEquals(
"home",
navHostController.currentBackStackEntry?.destination?.route,
)
}
}
calidion
01/12/2025, 7:38 AMAbhimanyu
01/12/2025, 7:38 AMcalidion
01/12/2025, 7:39 AMcalidion
01/12/2025, 7:40 AMcalidion
01/12/2025, 7:42 AMcalidion
01/12/2025, 7:43 AMChrimaeon
01/12/2025, 11:01 AMcreateComposeRule
?Abhimanyu
01/12/2025, 11:08 AMChrimaeon
01/12/2025, 11:11 AM404
not found - probably a private repo 🙂Abhimanyu
01/12/2025, 11:12 AMAbhimanyu
01/12/2025, 11:13 AMChrimaeon
01/12/2025, 11:14 AMhilt
invocations when using the androidx.activity.ComponentActivity
https://github.com/chrimaeon/compose-playground/blob/21fe99638ee5136b8a5fc089a4568[…]s/android/compose/screen/SharedElementTransitionScreenShould.ktWinson Chiu
01/12/2025, 11:19 AMAbhimanyu
01/12/2025, 11:19 AMWinson Chiu
01/12/2025, 11:19 AMAbhimanyu
01/12/2025, 11:24 AMIt sounds like you're calling hiltViewModel somewhere in the composition tree.Yes, that would be the case as I am testing the
NavHost
.
Thank You all. gratitude thank you