Android Program type already present: XXXX

本文介绍了解决Android开发中因重复依赖导致的Error:Programtypealreadypresent: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'
}

这个异常就解决了!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值