赞
踩
只要你是 Duplicate 开头的报错, 一定要看一下这个解决方法
只要你是 Duplicate 开头的报错, 一定要看一下这个解决方法
只要你是 Duplicate 开头的报错, 一定要看一下这个解决方法
今天改东西, 在没有新增任何jar包和aar包以及依赖的时候, Android studio 突然莫名其妙的报错了,
报错内容如下:
Duplicate class com.github.promeg.tinypinyin.android.asset.lexicons.AndroidAssetDict found in modules classes.jar (com.github.promeg.tinypinyin:tinypinyin-android-asset-lexicons:2.0.3) and classes.jar (com.github.promeg:tinypinyin-android-asset-lexicons:2.0.3)
Duplicate class com.github.promeg.tinypinyin.android.asset.lexicons.BuildConfig found in modules classes.jar (com.github.promeg.tinypinyin:tinypinyin-android-asset-lexicons:2.0.3) and classes.jar (com.github.promeg:tinypinyin-android-asset-lexicons:2.0.3)
Duplicate class com.github.promeg.tinypinyin.lexicons.android.cncity.BuildConfig found in modules classes.jar (com.github.promeg.tinypinyin:tinypinyin-lexicons-android-cncity:2.0.3) and classes.jar (com.github.promeg:tinypinyin-lexicons-android-cncity:2.0.3)
Duplicate class com.github.promeg.tinypinyin.lexicons.android.cncity.CnCityDict found in modules classes.jar (com.github.promeg.tinypinyin:tinypinyin-lexicons-android-cncity:2.0.3) and classes.jar (com.github.promeg:tinypinyin-lexicons-android-cncity:2.0.3)
Go to the documentation to learn how to Fix dependency resolution errors.
截图献上:
现在我们开始解决这个问题
现在我们开始解决这个问题
现在我们开始解决这个问题
./gradlew app:dependencies
如图:
Android studio 会查找所有依赖并输出日志到Terminal控制台, 如图(内容太多无法全部截图, 只截图部分内容以供查看):
找到刚才报错的日志内容, 复制报错内容中的括号里的依赖内容, 在刚才的Terminal控制台中搜索, 如图
搜索内容如图:
找到了, 是 me.yokeyword:indexablerecyclerview:1.3.0 这个依赖引用了 com.github.promeg.tinypinyin:tinypinyin-android-asset-lexicons:2.0.3 导致的程序报错, 我们先找到 me.yokeyword:indexablerecyclerview:1.3.0 的所在位置
全局搜索 me.yokeyword:indexablerecyclerview:1.3.0 , 如图
找到后, 删除或者替换即可, 我这里直接删除了, 我看了一下, 项目里压根就没有用这个库
再次运行, 错误解决了, 程序已经运行到手机上了
总结: 他大爷的, 项目里没有用到pinyin这个库, 找遍了所有文件和文件夹都没有找到和pinyin相关的任何内容, 突然就报错了, 看有人说是库的内容重复了, 也就是类重复了, 但是只有这一个库引用了pinyin的这个库, 真是坑爹呀, 一天又结束了…
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。