Hello! I have a few depencies in my Android proje...
# coroutines
i
Hello! I have a few depencies in my Android project which transitively depends on
kotlin-coroutines-core
different versions. I’ve used
resolutionStrategy
Gradle feature to force using the same 1.4.3 version of coroutines but during release build I get the R8 (ProGuard) error like:
Copy code
ERROR:/Users/*****/***********/app/build/intermediates/module_and_runtime_deps_classes/preliveGooglePlayRelease/base.jar: R8: Type kotlinx.coroutines.debug.AgentPremain is defined multiple times: /Users/*****/***********/app/build/intermediates/module_and_runtime_deps_classes/preliveGooglePlayRelease/base.jar:kotlinx/coroutines/debug/AgentPremain.class, /Users/*****/***********/voip_ui/build/intermediates/module_and_runtime_deps_classes/preliveGooglePlayRelease/feature-voip_ui.jar:kotlinx/coroutines/debug/AgentPremain.class
As I see
AgentPremain
indeed contained in both
kotlin-coroutines-core
and
kotlin-coroutines-core-jvm
with sligtly different byte code. The interesting thing is that
kotlin-coroutines-core
introduces the dependency to
kotlin-coroutines-core-jvm
according to Gradle dependency graph:
Copy code
+--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7 -> 1.4.3
|    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.3
and the POM file says the same:
Copy code
<dependency>
	<groupId>org.jetbrains.kotlinx</groupId>
	<artifactId>kotlinx-coroutines-core-jvm</artifactId>
	<version>1.4.3</version>
	<scope>compile</scope>
</dependency>
I wonder how two dependent libraries could have the same class but with different code inside them? Maybe I do something wrong?
1
l
Look at Gradle metadata (.module files), not the pom, they take precedence.
i
Solved. That’s was an issue in my Gradle configuration for Android dynamic features.