More than one file was found with OS independent path ‘META-INF/module_release.kotlin_module’

I saw this error when I was compiling a Titanium app. After some time I figured out this was happening after I added a second module to my project made in Kotlin (and not in Java). Apparently Kotlin adds this file to the build using the name of the directory. Because Titanium modules always have the same directory structure, this file was duplicated.

The way to solve it, it is by adding this in the module build.gradle file:

android {
  packagingOptions {
    exclude 'META-INF/module_release.kotlin_module'