[Android, Kotlin] Task :app:checkDebugDuplicateClasses FAILED 에러 문제 해결 Execution failed for task ':app:checkDebugDuplicateClasses'.

[문제 상황]

 

일정 관리 어플을 개발중이였는데 아래와 같은 에러가 발생했다.

 

Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
     Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
     Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
     Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
     Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
     Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
     Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
     Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
     Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)
     Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-26.0.2-runtime (com.android.support:support-compat:26.0.2)

 

com.android를 실행하는 중에 오류가 발생했다는데 Gradle 내부에 중복이 발생했다고 한다.

오랜만에 빌드를 진행하였는데 app : Gradle에 라이브러리를 추가하다가 문제가 발생한 것 같다.

 

[해결 방법]

 

라이브러리 충돌이 발생한 경우라고 한다.

외부 라이브러리를 사용할 때는 gradle.properties에 내용을 추가해 주어야 한다.

 

프로젝트 내부의 gradle.properties에 아래의 내용을 추가한다.

 

android.useAndroidX=true

android.enableJetifier=true

 

이후에 Sync Now를 진행한다.

 

useAndroidX는 프로젝트 생성 시 기본으로 추가 되어지며,

enableJetifier = true를 추가해주어야 외부 라이브러리를 사용할 수 있다고 한다.이는 androidX 와 외부 라이브러리 충돌이 일어나는 것을 방지해준다.

 

BUILD SUCCESSFUL in 30s
35 actionable tasks: 17 executed, 18 up-to-date

 

해결완료