I got a META-INF error I have never seen when mixi...
# coroutines
d
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 🧵
1
Copy code
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
Maybe something like this?
j
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
Thanks, what exactly am I excluding?
Copy code
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:
Copy code
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
c
@dewildte were you doing kotlin multiplatform by chance? I'm getting this same exact error, but not sure where to put the exludes. doesn't seem to work under common or under android
nvm. i reverted kotlinx serialization from 1.6.0rc to 1.5.1 and that got rid of the error
👍 1
604 Views