Anyone know Nav3 Support in KMP or not?
# compose
m
Anyone know Nav3 Support in KMP or not?
m
I use this according to doc but still got this error
Copy code
nav3Core = "1.0.0-alpha06"
lifecycleViewmodelNav3 = "2.10.0"

androidx-navigation3-ui = { module = "org.jetbrains.androidx.navigation3:navigation3-ui", version.ref = "nav3Core" }
androidx-lifecycle-viewmodel-navigation3 = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-navigation3", version.ref = "lifecycleViewmodelNav3" }
androidx-material3-adaptive-navigation3 = { group = "org.jetbrains.compose.material3.adaptive:adaptive-navigation3", name = "adaptive-navigation3", version.ref = "material3AdaptiveNav3" }
Error: Configuration cache state could not be cached: field
__runtimeDependenciesNavigationFiles__
of task
:composeApp:processDebugNavigationResources
of type `com.android.build.gradle.internal.tasks.ProcessNavigationXmlTask`: error writing value of type 'org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection'
Could not resolve all files for configuration 'composeAppdebugRuntimeClasspath'.
> Could not find org.jetbrains.androidx.lifecyclelifecycle viewmodel navigation32.10.0. Required by: project :composeApp > Could not find org.jetbrains.compose.material3.adaptiveadaptive navigation3adaptive-navigation3:1.3.0-alpha05. Required by: project :composeApp
s
There is no
org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-navigation3:2.10.0
, 2.10.0-alpha07 is the latest on maven central. https://central.sonatype.com/artifact/org.jetbrains.androidx.lifecycle/lifecycle-viewmodel-navigation3
m
for nav3 we don't need viewmodel or lifecycle libs? see this link here its mention that its experimental https://kotlinlang.org/docs/multiplatform/whats-new-compose-110.html#support-for-navigation-3
s
I haven't switched yet. Just mentioning that the version you tried doesn't exist.
Jetbrains versions are similar, but different from AndroidX versions.
m
hm but i also try another version but don't know why i get this error
j
fwiw example here of its use in CMP project https://johnoreilly.dev/posts/navigation3-cmp/
s
lifecycleViewmodelNav3 = "2.10.0"
should be
lifecycleViewmodelNav3 = "2.10.0-alpha07"
JetBrains posts the coordinates to their packages in the release notes for each CMP release. See: https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.10.0-rc02
m
@Sean Proctor @John O'Reilly Thanks both of you using your reference content issue is fixed, here is brief:
Copy code
#Version
composeMultiplatform = "1.10.0-rc02" or use this composeMultiplatform = "1.9.3"
nav3Core = "1.0.0-alpha06"
lifecycleViewmodelNav3 = "2.10.0-alpha07"
material3AdaptiveNav3 = "1.3.0-alpha01"

androidx-navigation3-ui = { module = "org.jetbrains.androidx.navigation3:navigation3-ui", version.ref = "nav3Core" }
androidx-lifecycle-viewmodel-navigation3 = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-navigation3", version.ref = "lifecycleViewmodelNav3" }
androidx-material3-adaptive-navigation3 = { module = "org.jetbrains.compose.material3.adaptive:adaptive-navigation3", version.ref = "material3AdaptiveNav3" }
100 Views