Error while adding MoshiPack
Library in Kotlin
latest version 1.3.70 to gradle.build
application
Moshi pack
implementation 'com.daveanthonythomas.moshipack:moshipack:1.0.1'
Error Message
Duplicate class kotlin.reflect.KClasses found in modules jetified-kotlin-reflect-1.1.1.jar (org.jetbrains.kotlin:kotlin-reflect:1.1.1) and jetified-kotlin-stdlib-1.3.70.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.70)
Any suggestions how to solve this issue or any other library I can use in Kotlin
so I can use Message Pack.
Thanks in advance
Starting Kotlin 1.3.70 some basic useful members on KClass
included in Kotlin standard library (they were in a kotlin-reflect
before).
See "Working with KClass" in https://blog.jetbrains.com/kotlin/2020/03/kotlin-1-3-70-released/
In your case MoshiPack
adds a kotlin-reflect
library that conflicts with standard library.
You should exclude transitive dependency to resolve the conflict.
If you use KotlinDSL, in build.gradle.kts
:
implementation ("com.daveanthonythomas.moshipack:moshipack:1.0.1") {
exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
}
If you use Groovy, in build.gradle
:
implementation ('com.daveanthonythomas.moshipack:moshipack:1.0.1') {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-reflect'
}