Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 454 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Duplicate class in Kotlin Android

#1
![Image Example](
)

I kept on getting error that there is duplicate error in classes.
[This is what i have under org.jetbrains.kotlin folder](
)
[.idea/libraries](
)

it seems like the problem is because there is two different dependencies for the kotlin, from stdlib and stdlibjdk8 but I don't know how to remove either one from my module/project dependencies. Please help :(

Here's the full error code :

~~~
Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.io.path.ExperimentalPathApi found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.io.path.PathRelativizer found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.io.path.PathsKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.io.path.PathsKt__PathReadWriteKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.io.path.PathsKt__PathUtilsKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.jdk7.AutoCloseableKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.jvm.jdk8.JvmRepeatableKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.streams.jdk8.StreamsKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$1 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$2 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$3 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$4 found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.text.jdk8.RegexExtensionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.time.jdk8.DurationConversionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
~~~


I've tried deleting the files from the org.jetbrains.kotlin but whenever i build the app in Android Studio, the files will be re-downloaded again.

this is my module app gradle code

~~~groovy

plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}

android {
compileSdk 33

defaultConfig {
applicationId "com.example.umfs"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
viewBinding true
}

namespace 'com.example.umfs'
}

dependencies {


implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-database:20.1.0'
implementation 'androidx.preference:preference:1.2.0'
implementation 'com.google.firebase:firebase-auth:21.1.0'
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'androidx.navigation:navigation-fragment:2.5.3'
implementation 'androidx.navigation:navigation-ui:2.5.3'
implementation 'com.google.firebase:firebase-firestore:24.4.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation "androidx.cardview:cardview:1.0.0"
implementation 'com.google.firebase:firebase-firestore:24.4.1'
implementation 'com.google.firebase:firebase-storage:20.1.0'
implementation 'com.google.firebase:firebase-database'
implementation platform('com.google.firebase:firebase-bom:28.4.0')
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.github.bumptech.glide:glide:4.14.2'
implementation 'com.github.marlonlom:timeago:4.0.3'
implementation "androidx.core:core-ktx:+"

}

apply plugin: 'com.google.gms.google-services'
~~~
Reply

#2
According to the release notes of Kotlin 1.8.0 (

[To see links please register here]

), you shouldn't specify `kotlin-stdlib-jdk7` nor `kotlin-stdlib-jdk8` as dependencies anymore and, instead, just use `kotlin-stdlib`.
Reply

#3
Simply. For me just change this gradle plugins from 1.7.10 to 1.8.0 Then sync. => invalidate caches => build

From:

plugins {
....
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}



To:

plugins {
....
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}
Reply

#4
I solved the problem by changing kotlin class path dependency in the root `build.gradle` file from
```
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20-RC"
```
to
```
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
```
Reply

#5
for compose, use stable-version of material3

`androidx.compose.material3:material3:1.0.1`

and than

`id 'org.jetbrains.kotlin.android' version '1.7.0' apply false`
Reply

#6
I had same issue while it was working 2 days ago...

I changed to

composeOptions {
kotlinCompilerExtensionVersion '1.3.2'
}

and
`id 'org.jetbrains.kotlin.android' version '1.7.20' apply false`
in build.gradle (Project)

Then clean and rebuild project.
Reply

#7
I had the same error in my project but mine was caused by different jetpack compose libraries having different versions and I put the specific version number `"1.3.3"` which caused other libraries that have later version numbers to not be found. I fix this by using compose BOM which provides the latest version to each library
Reply

#8
If you are using Compose you need to update the Compose Compiler (

[To see links please register here]

) to 1.4.2 and Kotlin to 1.8.10 at the same time.
Reply

#9
I noted the issue specifically after upgrading to these 2 libraries:

- **`Material3`** version **`1.1.0-alpha05`**

- **`Runtime-livedata`** version **`1.4.0-beta01`**

This is are full dependencies:

implementation 'androidx.compose.runtime:runtime-livedata:1.4.0-beta01'
implementation 'androidx.compose.material3:material3:1.1.0-alpha04'
This is the error I was getting with **`Jdk-18.0.2`**

> Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in
> modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0)
> and kotlin-stdlib-jdk8-1.7.20

The way around it for the time being is to downgrade these 2 libraries until the bug is corrected or updates are made.

implementation 'androidx.compose.material3:material3:1.1.0-alpha04'
implementation 'androidx.compose.runtime:runtime-livedata:1.4.0-alpha01'

Mind you there may be other dependencies that are affected and if you have recently upgraded the dependencies, you may need to rollback the updates and eliminate the library one by one to identify the troublesome one.
Reply

#10
### Update 2023

Recently, I had the same issue where most of the duplicate classes belonged to Kotlin. One of the errors was something like this:

```
Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
```

I had this issue because I was using a buggy kotlin version. Upgrade your kotlin version to `1.8.0-Beta`. Follow this:

in your `android/build.gradle`, first add this in the `ext` section:

```
kotlinVersion = "1.8.0-Beta"
```

Now, go down to the dependencies section and add this:

```
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
```

Finally, make sure your `JAVA_HOME` points to a JDK11.

Doing these fixed my problem. Hope it helps!
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through