Duplicate files copied in APK

I have a problem with version 1.0.4 ( it was also with 1.0.3), Android Studio 2.2, Gradle 2.2.1:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:transformResourcesWithMergeJavaResForMitrakoRelease’.

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK kotlin/internal/internal.kotlin_builtins
File1: /home/astalos/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/1.0.4/8e25da5e31669f5acf514bdd99b94ff5c7003b3b/kotlin-runtime-1.0.4.jar
File2: /home/astalos/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.0.4/172b43fbc03b521fed141484b212d6725fa671a9/kotlin-compiler-embeddable-1.0.4.jar

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Gradle buildscript is as basic as possible. What might cause this error?

Please show how exactly your build script is configured. Looks like you’ve added the Kotlin compiler as the dependency of your application, and you shouldn’t do that.

Hi Yole. I am facing the same problem. Please find my gradle files in the below link:

http://stackoverflow.com/questions/41642982/duplicatefileexception-in-apk-build-using-kotlin

Let me know if the build script is configured wrong?