Ahsan Ali
Ahsan Ali

Reputation: 361

How to exclude Duplicate Class without changing Version

I'm using Coroutine and Paging 3 Libary on my project on changing new Version of libary most of the time i will get this Duplicate Class Error , So what is the proper way to get rid of such problems with changing library version...

 Duplicate class kotlinx.coroutines.AbstractCoroutine found in modules jetified-kotlinx-                       
 coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1) and    
 jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines- 
 core:1.4.1)
 Duplicate class kotlinx.coroutines.Active found in modules jetified-kotlinx-coroutines-core-
 jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1) and jetified-kotlinx-
 coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1)

 Duplicate class kotlinx.coroutines.AwaitAll found in modules jetified-kotlinx-coroutines-core- 
 jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1) and jetified-kotlinx-
 coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1)
 Duplicate class kotlinx.coroutines.AwaitAll$AwaitAllNode found in modules jetified-kotlinx-
coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1) and 
 jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-
 core:1.4.1)

Upvotes: 4

Views: 1497

Answers (2)

I love Tree
I love Tree

Reputation: 11

I resolved it.

def paging_version_3 = "3.0.0-alpha12"
implementation ("androidx.paging:paging-runtime-ktx:$paging_version_3")
{
    exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-coroutines-core-jvm'
}
// optional - RxJava3 support
implementation ("androidx.paging:paging-rxjava3:$paging_version_3")
{
    exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-coroutines-core-jvm'
}
// leanback paging library
implementation ("androidx.leanback:leanback-paging:1.1.0-alpha07")
{
    exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-coroutines-core-jvm'
}

Upvotes: 1

user15011370
user15011370

Reputation: 9

exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-coroutines-core-jvm'

You can remove and clear the cache and recompile it , under the Gradle Plugin module,find the Dependencies under Help

Upvotes: 0

Related Questions