내가 불러온 라이브러리끼리 클래스가 겹치는 아주 슬프고 곤란한 상황이 왔다.
implementation ('com.cxpublic:cxense-android:1.0.1') {
exclude group: "com.android.support", module: "support-v4"
}
라이브러리를 불러올 때 작성하는 것을 보면 그룹:모듈:버전 순으로 되어 있는데, 그룹과 모듈을 한번에 작성하여 어떤 모듈을 딱 집을 수도 있고, 아예 한 그룹의 모듈을 통채로 제거할 수 있다.
android {
// Some other stuffs
configurations {
all*.exclude module: 'support-v4' // This removes all other versions of `support-v4` if gets duplicated from all the artifacts.
}
// Rest of other stuffs
}
아예 모든 라이브러리들에서 해당 모듈을 받아오지 않는다.
모듈 말고 그룹으로 제거할 수도 있다.
https://stackoverflow.com/questions/56695106/duplicated-classes-found-in-modules-classes-jar