Android Program type already present: XXXX

Error : Program type already present: XXXX

Android 开发中经常会遇到 AS 报这个类型的错误,不要慌,这个错误的意思是:你的项目里面存在重复依赖的问题。举个例子:

implementation 'com.github.ifmvo:Matthew_ImageLoader:1.1.3'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.43-alpha1'

假如你的项目里面添加了两个依赖,并且这两个依赖里面同时存在另外一种依赖

implementation 'androidx.appcompat:appcompat:1.0.2'

这种情况下编译就会报出 Error : Program type already present: XXXX 这个异常。

那怎么解决这个问题呢?既然是同时存在导致的冲突,那么删除掉一个不就行了么!

implementation 'com.github.ifmvo:Matthew_ImageLoader:1.1.3'
implementation ('com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.43-alpha1'){
    exclude group: 'com.android.support', module: 'support-annotations'
}

implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.43-alpha1'
implementation ('com.github.ifmvo:Matthew_ImageLoader:1.1.3'){
    exclude group: 'com.android.support', module: 'support-annotations'
}

这个异常就解决了!

你可能感兴趣的:(Android,Andorid,安卓,异常)