Duplicate files copied to APK META-INF / library_release.kotlin_module
I recently added two Android Libraries via JitPack and I have the following error:
Duplicate files copied in APK META-INF/library_release.kotlin_module
I cleared the caching and I tried to exclude the module using
exclude group: 'org.jetbrains'
and
exclude group: 'org.jetbrains.kotlin'
but it seems the issue persists. Is there a way to stop adding kotlin stdlib via JitPack? Oddly enough, other libraries like DbFlow don't have this problem, although I don't see anything special about setting them up (other than not via JitPack)
source to share
As suggested : jetbrains
Make sure these .kotlin_module files are not removed by your packaging process.
Thus, we cannot use the exclude
option to exclude this resource file from the moment of creation.
As described in this post , we must:
in Maven we use groupId and artifactId for module names, but you can tell
<configuration>
<moduleName>com.example.mymodule</moduleName>
</configuration>
in Gradle its project name + build task name to set up:
compileKotlin {
kotlinOptions.moduleName = "com.example.mymodule"
}
This is my config for the library project Android
:
ext {
GROUP_ID = 'custom.group.id'
ARTIFACT_ID = 'artifactid'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
compileOptions {
kotlinOptions.freeCompilerArgs += ['-module-name', "$GROUP_ID.$ARTIFACT_ID"]
}
defaultConfig {
...
}
buildTypes {
...
}
}
A resource file named META-INF/custom.group.id.artifactId.kotlin_module
will be created instead. META-INF/library_release.kotlin_module
No more duplicate files will be found.
source to share