How do i get rid of Duplicate class error in android studio

Viewed 26
Duplicate class javax.annotation.CheckForNull found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2)

Duplicate class javax.annotation.CheckForSigned found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.CheckReturnValue found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.Detainted found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.MatchesPattern found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.MatchesPattern$Checker found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.Nonnegative found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.Nonnegative$Checker found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.Nonnull found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.Nonnull$Checker found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.Nullable found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.OverridingMethodsMustInvokeSuper found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.ParametersAreNonnullByDefault found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.ParametersAreNullableByDefault found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.PropertyKey found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.RegEx found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.RegEx$Checker found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.Signed found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.Syntax found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.Tainted found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.Untainted found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.WillClose found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.WillCloseWhenClosed found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.WillNotClose found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.concurrent.GuardedBy found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.concurrent.Immutable found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.concurrent.NotThreadSafe found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.concurrent.ThreadSafe found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.meta.Exclusive found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.meta.Exhaustive found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.meta.TypeQualifier found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.meta.TypeQualifierDefault found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.meta.TypeQualifierNickname found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.meta.TypeQualifierValidator found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class javax.annotation.meta.When found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jsr305-3.0.2 (com.google.code.findbugs:jsr305:3.0.2) Duplicate class net.jcip.annotations.GuardedBy found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jcip-annotations-1.0 (net.jcip:jcip-annotations:1.0) Duplicate class net.jcip.annotations.Immutable found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jcip-annotations-1.0 (net.jcip:jcip-annotations:1.0) Duplicate class net.jcip.annotations.NotThreadSafe found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jcip-annotations-1.0 (net.jcip:jcip-annotations:1.0) Duplicate class net.jcip.annotations.ThreadSafe found in modules jetified-annotations-3.0.1 (com.google.code.findbugs:annotations:3.0.1) and jetified-jcip-annotations-1.0 (net.jcip:jcip-annotations:1.0) Duplicate class org.apache.commons.logging.Log found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-spring-jcl-5.3.13 (org.springframework:spring-jcl:5.3.13) Duplicate class org.apache.commons.logging.LogFactory found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-spring-jcl-5.3.13 (org.springframework:spring-jcl:5.3.13) Duplicate class org.apache.commons.logging.LogFactory$1 found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-spring-jcl-5.3.13 (org.springframework:spring-jcl:5.3.13) Duplicate class org.apache.commons.logging.impl.NoOpLog found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-spring-jcl-5.3.13 (org.springframework:spring-jcl:5.3.13) Duplicate class org.apache.commons.logging.impl.SimpleLog found in modules jetified-commons-logging-1.2 (commons-logging:commons-logging:1.2) and jetified-spring-jcl-5.3.13 (org.springframework:spring-jcl:5.3.13)

Go to the documentation to learn how to Fix dependency resolution errors.

1 Answers

Solution-1:

Add this line to your gradle.properties file and sync your project.

android.enableJetifier = true

Solution 2:

Step 1: Check any duplicate dependency in the app level gradle.build

Step 2: Remove any duplicate entries that are discovered.

step 3: Sync the project with gradle files

step 4: clean and rebuild the APK

Solution 3:

Step 1: Examine the libs folder (ProjectFolder/app/libs) for any duplicate libraries.

Step 2: If a duplicate library is discovered, remove it.

step 3: Sync the project with gradle files

step 4: clean and rebuild the APK

Related