Using CMP 1.7.0 and the navigation suite (by JetBr...
# compose
o
Using CMP 1.7.0 and the navigation suite (by JetBrains), it works fine on Jvm but fails on Android due to duplicate classes. Should I declare jetbrains dependencies for jvmMain & androidx for androidMain? how to consume in commonMain then? How are we supposed to handle this? Ex:
Copy code
Duplicate class androidx.compose.material3.adaptive.layout.AdaptStrategy found in modules adaptive-layout-desktop-1.0.0.jar -> adaptive-layout-desktop-1.0.0 (org.jetbrains.compose.material3.adaptive:adaptive-layout-desktop:1.0.0) and adaptive-layout-release.aar -> adaptive-layout-release-runtime (androidx.compose.material3.adaptive:adaptive-layout-android:1.0.0)
solved 1
1
in my
:shared
module
commonMain.dependencies
Copy code
implementation(compose.material3AdaptiveNavigationSuite)
implementation(libs.compose.m3.adaptive)
implementation(libs.compose.m3.adaptive.layout)
implementation(libs.compose.m3.adaptive.navigation)
in my
:android
and
:desktop
module, nothing fancy, just activity compose for
:android
(also used in
androidMain.dependencies
in
:shared
)
Copy code
compose-m3-adaptive = { module = "org.jetbrains.compose.material3.adaptive:adaptive", version.ref = "compose-m3-adaptive" }
compose-m3-adaptive-layout = { module = "org.jetbrains.compose.material3.adaptive:adaptive-layout-desktop", version.ref = "compose-m3-adaptive" }
compose-m3-adaptive-navigation = { module = "org.jetbrains.compose.material3.adaptive:adaptive-navigation-desktop", version.ref = "compose-m3-adaptive" }
t
i had the same issue with CMP 1.7.0, but the strange thing is that i've had this issue only when i was using android studio ide, when i open the project in IntelliJ IDE this error doesn't occur and everthing works fine not sure if i'm missing something here, ps: i'm newbie to KMP jumping directly from React
o
Same happens with Gradle in CLI on my side
i
You're explicitly adding
-desktop
variant to android => duplicate classes
💯 1
1
o
I think I mispelled the dependency by adding a
-desktop
while testing around… 🤦‍♂️
Ahh ahh, cross message, same conclusion 👍
👍 1
Indeed, was my mistake. That being said, I don't get where does come from the duplication, I would have expected a crash, anyway, problem solved.
i
both are jvm, so it can be used as a dependency. But in fact there is not supported API usage inside
duplication is because both contain the same classes as public APIs
o
yes, but I don't get from where the android one come from, when having both, I get the duplication indeed I was only adding the
-desktop
i
Most likely dependency of something. To inspect the deps tree you can use
./gradlew :composeApp:dependencies
o
that's what I was checking indeed, it was at the root, so I guess it comes from
Copy code
implementation(compose.material3AdaptiveNavigationSuite)
1