I add Kotlin to the gradle.build with dependency (Kotlin version 1.0.4):
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
As I found out it has a conflict with my other dependency:
compile 'org.jetbrains:annotations-java5:15.0'
After I run the build it crashes with the ZipException:
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/jetbrains/annotations/Nullable.class
What I already tried:
I tried this solution: Kotlin,Java,multidex,Dagger 2,Butterknife and Realm: transformClassesWithJarMergingForDebug: duplicate entry: org/jetbrains/annotations/NotNull.class But it ended up, that not only Nullable.class and NotNull.class were duplicates, but also classes from org/intellij/lang/annotations/.
After I added five classes it still crashed. Is there a better way to get rid of this problem, by not adding every class manually that causes this exception?
UPDATE (02.02.16)
As I worked a bit on the problem, I found out that for my project the relevant annotation classes are NonNls.class
and Contract.class
that are missing, if I remove org.jetbrains:annotations-java5:15.0
. They are not in kotlin-runtime, but in the Jetbrains annotation dependency. How can I add it without adding the Jetbrains annotation dependency again?