Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.RuntimeException: Duplicate class org.intellij.lang.annotations.Flow found in modules annotations-16.0.1.jar and annotations-java5-15.0.jar

Text of the output:

 Execution failed for task ':app:checkDebugDuplicateClasses'.
1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class org.intellij.lang.annotations.Flow found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.Identifier found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$AdjustableOrientation found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$BoxLayoutAxis found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$CalendarMonth found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$CursorType found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$FlowLayoutAlignment found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$FontStyle found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$HorizontalAlignment found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$InputEventMask found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$ListSelectionMode found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$PatternFlags found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$TabLayoutPolicy found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
  Duplicate class org.intellij.lang.annotations.JdkConstants$TabPlacement found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
like image 712
Khương Mai Avatar asked Nov 17 '19 18:11

Khương Mai


1 Answers

It's the Conflict between two jars. You can either figure out which one you are not using from Modules_annotation 16.XXX and annotations-java5-XXXX jar files.

I found out two ways to solve this.

  1. Excluding the JetBrains annotations module is a workaround; why is it in your project in the first place? Most likely, it got automatically added to your classpath by Android Studio when what you really wanted was Android's own annotations.

So, a better solution is to look for an org.jetbrains:annotations dependency in your build.gradle file[s], like this:

implementation 'org.jetbrains:annotations-java5:15.0'

...and remove it.

If 1 is not working

  1. Please add the following line in your Module level build.gradle.
configurations {
            cleanedAnnotations
             compile.exclude group: 'org.jetbrains' , module:'annotations'
         }
like image 67
Harsh Mishra Avatar answered Sep 23 '22 12:09

Harsh Mishra