Reputation: 32271
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"
}
Upvotes: 8
Views: 3277
Reputation: 507
Try adding this to your build.gradle . in packagingOptions:
packagingOptions {
...
exclude 'META-INF/rxkotlin.properties'
exclude 'META-INF/rxkotlin_main.kotlin_module'
}
Upvotes: 2
Reputation: 104
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.
Upvotes: 2
Reputation: 32271
This is so annoying, but running Clean Project fixed the problem for me.
Upvotes: 11