https://kotlinlang.org logo
Title
d

dewildte

04/06/2023, 12:19 PM
I got a META-INF error I have never seen when mixing some coroutines libs in my android project. I could really use some eyes on this one as I have tried everything. Heck, I hate ChatGPT and I even asked it for help. SO is empty too. Error in the 🧵
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
   > 2 files found with path 'META-INF/versions/9/previous-compilation-data.bin' from inputs:
      - /Users/erock/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-android/1.7.0-Beta/6abaac85e7240bf34c607862217aa8576ebe339e/kotlinx-coroutines-android-1.7.0-Beta.jar
      - /Users/erock/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.7.0-Beta/1db29d377fe1e399eabe883d825f2f4b0dd4959a/kotlinx-coroutines-core-jvm-1.7.0-Beta.jar
t

Tgo1014

04/06/2023, 12:29 PM
Maybe something like this?
j

jw

04/06/2023, 12:40 PM
Yes. Exclude it. The coroutine issue tracker is the place to look as there have been multiple issues and a fix already integrated for the next version.
d

dewildte

04/06/2023, 1:02 PM
Thanks, what exactly am I excluding?
packagingOptions {
        resources {
            excludes.add("META-INF/versions/9/previous-compilation-data.bin") // <-- This?
            excludes.add("/META-INF/{AL2.0,LGPL2.1}")
            excludes.add("DebugProbesKt.bin")
        }
    }
Adding:
excludes.add("META-INF/versions/9/previous-compilation-data.bin")
Works and I can build and run now. But there are further issues down the road when I do this. Like Compose UI tests fail to find certain functions at runtime.
Like this one:
No static method runTest$default(Lkotlinx/coroutines/test/TestScope;JLkotlin/jvm/functions/Function2;ILjava/lang/Object;)V in class Lkotlinx/coroutines/test/TestBuildersKt; or its super classes (declaration of 'kotlinx.coroutines.test.TestBuildersKt' appears in /data/app/~~elfaoIT7UpEP5DQTFVhLaQ==/com.publicmethod.famjam.android-FjIqBLwHEtYSmCFUQ16YTw==/base.apk!classes22.dex)
Ok that’s in the issue tracker too.
Nice!
Thanks @jw @Tgo1014