I am dealing with a build problem :
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
> 2 files found with path 'META-INF/annotation-experimental_release.kotlin_module'
and It can be fixed by adding those lines to build.gradle on app directory, as suggested on other tickets.
packagingOptions {
exclude("META-INF/*kotlin_module")
}
Is it safe to exclude META-INF/? is it can cause any problems? I am not using kotlin on my code, that's come from other sdks .
This can be possibly dangerous if you publish a library and exclude META-INF/*kotlin_module. In my case it caused unresolved reference errors when trying to invoke some global Kotlin functions from this library. My advice is avoid excluding this.
There's a bit of confusing information out there...
TLDR If the jar files are only for yourself and you don't use reflection, you can exclude the files.
As described here: https://blog.jetbrains.com/kotlin/2015/09/kotlin-m13-is-out/
A few months ago we announced this change and now it’s done:
We had to introduce a new resource file that is required to compile Kotlin code against Kotlin binaries. Its name is META-INF/<module_name>.kotlin_module. Make sure these .kotlin_module files are not stripped by your packaging process.
Also, make sure that module names do not clash in your project
As also commented on further here: https://youtrack.jetbrains.com/issue/KT-9770 (these files are used only for reflection and during the build process)
kotlin.reflect.*)For some Kotlin classes, we cannot store the metadata in the annotation because the class does not physically exist (Int, List, etc), so we store this information in separate resources. This is what .kotlin_builtins files are for. For top level declarations, we need to know what files does the package consist of, this is what .kotlin_module files are for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With