Solvedkotlinx.coroutines Compilation error on the androidTest configuration after updating to 1.3.6
✔️Accepted Answer
I found 2 workarounds:
- Exclude the duplicated files:
packagingOptions {
exclude "**/attach_hotspot_windows.dll"
exclude "META-INF/licenses/**"
exclude "META-INF/AL2.0"
exclude "META-INF/LGPL2.1"
}
- Exclude the
kotlinx-coroutines-debug
dependency
resolutionStrategy {
exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug"
}
Other Answers:
I've tracked the problem to be a conflict between the kotlinx-coroutines-debug package and mockito and how they include the ByteBuddy library.
Mockito includes ByteBuddy as a dependency, however the coroutines-debug imbeds ByteBuddy directly. Seems the best solution is coroutines-debug switches to a dependency model or does something to ensure the embedded version will not conflict with other libraries.
While mockito is the dependency that I hit, it is possible other libraries that depend ByteBuddy could generate this conflict.
I'm working around the problem by excluding the debug library which is a drag along dependency that I am not using.
androidTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version") {
// conflicts with mockito due to direct inclusion of byte buddy
exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug"
}
Thanks @dmarin. Just by putting:
packagingOptions {
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
}
Already did the trick
This issue still persists in 1.3.7
This issue still persists in 1.4.0
The compilation error occurs after updating to
1.3.6
, and it gets fixed if I downgrade to1.3.5
.Kotlin Version 1.3.72
The coroutines dependencies I am using are:
Stacktrace: