android解决jar包重复问题:IDE报错发现重复类
引⼊三⽅SDK出现:Duplicate x found in modules
例如:Duplicate class dec.BinaryDecoder found in modules jetified-commons-codec-1.5.jar (commons-codec:commons-codec:1.5) and jetified-org.apache.http.legacy.jar (org.apache.http.legacy.jar)
翻译:在jetified-commons-codec-1.5.jar(commons codec:commons codec:1.5)和jetified-
org.apache.http.legacy.jar(org.apache.http.legacy.jar)模块中到重复的dec.BinaryDecoder类
解决:
⼀、定位。
Android studio - Navigate-Class-搜索重复的类
⼆、点开重复的jar,处理
1、如jar⽆⽤可直接删除。
2、⽤ 解决,就是去掉 你不需要的类 如:
implementation ('fit2:converter-gson:2.3.0'){
exclude group:'de.gson'android retrofit
exclude group: 'com.squareup.okhttp3'
}
或者
exclude module:'glide'
三、如果依然⽆效,则改变三⽅库内的jar的引⼊⽅式。
这时候需要将implementation fileTree(dir:'libs',include: ['*.jar']) 去掉。
单独引⽤jar,将冲突改为compileOnly
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论