I'm creating a new project from scratch in Android Studio Flamingo 2022.2.1 Patch 2. As stated in the Android Developer docs for Jetpack Navigation, I've added the dependency:
implementation("androidx.navigation:navigation-compose:2.6.0")
There is no other code or any other added dependencies in the project. I have added no other dependencies. However, despite having done nothing other than add the above dependency I get a "Duplicate Class Error"
Execution failed for task ':app:checkDebugDuplicateClasses'
A failure occurred while executing
com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
I'm trying to learn Jetpack Compose and now totally stuck because of this. I've got no idea how to resolve the issue. I've tried doing "invalidate cache and restart". I've also tried checking for updates and updating to the latest version.
UPDATE**
All the duplicate errors are similar to this one:
> Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules kotlin-stdlib-1.8.20 (org.jetbrains.kotlin:kotlin-stdlib:1.8.20) and kotlin-stdlib-jdk8-1.7.20 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20)
They all have something to to with "kotlin-stdlib-1.8.20" and "kotlin-stdlib-jdk8-1.7.20".
UPDATE 2** I tried to use dependencyInsight tool but got a JAVA_HOME environmental variable error.
I tried using an older version of Jetpack Navigation and it worked. I then tried creating a new project and it seemed the automatically created dependencies changed and now it works.
Conclusion - Really not sure what was going. Not sure if I should delete this post now.