After updating to Android 3.0, getting Kotlin error:
Execution failed for task ':myLibrary:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug'.
> java.lang.RuntimeException: java.util.zip.ZipException: duplicate entry: META-INF/myLibrary.kotlin_module
This is my library buid.gradle file:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
...
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
This is my project build.gradle
ext.kotlin_version = '1.1.51'
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
This is so annoying, but running Clean Project fixed the problem for me.
Try adding this to your build.gradle . in packagingOptions:
packagingOptions {
...
exclude 'META-INF/rxkotlin.properties'
exclude 'META-INF/rxkotlin_main.kotlin_module'
}
Looks like a cache error (with kotlin) to me. Running gradle clean
or gradle clear
(not sure which is the right spelling, sorry, one of these should exist as a gradle task) and rebuilding should fix the error, because all files in cache will be deleted by the task and regenerated by the project build.
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