compose-destinations icon indicating copy to clipboard operation
compose-destinations copied to clipboard

java.lang.IllegalStateException: Duplicate route found X_destination'. Routes must be unique!. In Muli-module project.

Open Velord opened this issue 1 year ago • 0 comments

I have

@Destination<ExternalModuleGraph>
@Composable
fun SettingsDestination() {
...
}

private const val BOTTOM_NAVIGATION_GRAPH = "bottom_navigation_graph"
@NavHostGraph(route = BOTTOM_NAVIGATION_GRAPH)
annotation class BottomNavigationGraph {
    @ExternalDestination<SettingsDestinationDestination>()
    companion object Includes
}

Also I have graph that belongs to BottomNavigationGraph and has SettingsDestination

private const val X_GRAPH = "x_graph"
@NavGraph<BottomNavigationGraph>(route = X_GRAPH, start = true)
annotation class XGraph {
    @ExternalDestination<SettingsDestinationDestination>()
    companion object Includes
}

Simple workaround can be like that:

@Destination<ExternalModuleGraph>
@Composable
fun SettingsBottomGraphDestination() {
...
}

@Destination<ExternalModuleGraph>
@Composable
fun SettingsXGraphDestination() {
...
}

In that case I don't receive any benefit of splitting destinations to different modules. Am I missing some API ? May you suggest something ?

Velord avatar May 09 '24 13:05 Velord