Type kotlin.coroutines.jvm.internal.DebugProbesKt is defined multiple times
使用的是最新的replugin 3.1. 使用了kotlinx-coroutines-core-jvm 打包后报错, 发现DebugProbesKt 在多个dex的包定义了.
新建插件工程,做插件开发,导入plugin-gradle 3.1.0&plugin.lib3.1.0也遇到了该问题,有大佬知道如何解决?
新建插件工程,做插件开发,导入plugin-gradle 3.1.0&plugin.lib3.1.0也遇到了该问题,有大佬知道如何解决?
自己构建kotlin协程库的依赖, 然后将DebugProbesKt 从源代码中删除, 自己构建。 生产环境使用自己构建的coroutin的包。
谢谢解答!我是基于demo2进行代码迁移,可以完成插件开发流程。但是当加入新的依赖库 (work-rumtime)后会出现这个问题,此方法可用。
请问下,我纯java的工程,没有依赖kt 为啥也会报这个错啊?
可以基于demo2做研究,把相关代码进行移植
要把kotlin协程库源码下载下来,删除DebugProbesKt ,做成jar包吗?
force("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0")最简单的方式, 因为 kotlinx:kotlinx-coroutines-core:1.4.0以后,都会有DebugProbesKt.bin,应该是这个问题 fun testClassFileContent() { val clz = Class.forName("kotlin.coroutines.jvm.internal.DebugProbesKt") val classFileResourcePath = clz.name.replace(".", "/") + ".class" val array = clz.classLoader.getResourceAsStream(classFileResourcePath).use { it.readBytes() } assertJava8Compliance(array) // we expect the integration testing project to be in a subdirectory of the main kotlinx.coroutines project val base = File("").absoluteFile.parentFile val probes = File(base, "kotlinx-coroutines-core/jvm/resources/DebugProbesKt.bin") val binContent = probes.readBytes() if (overwrite) { FileOutputStream(probes).use { it.write(array) } println("Content was successfully overwritten!") } else { assertTrue( array.contentEquals(binContent), "Compiled DebugProbesKt.class does not match the file shipped as a resource in kotlinx-coroutines-core. " + "Typically it happens because of the Kotlin version update (-> binary metadata). " + "In that case, run the same test with -Poverwrite.probes=true." ) } } 源码 反射获取kotlin.coroutines.jvm.internal.DebugProbesKt,会再次打包一个kotlin.coroutines.jvm.internal.DebugProbesKt到jar里,r8时就报错了