More|More than one file was found with OS independent path 'META-INF/INDEX.LIST'

问题描述:
【More|More than one file was found with OS independent path 'META-INF/INDEX.LIST'】build可以成功,但是Gradle打包运行时报错:“More than one file was found with OS independent path 'META-INF/INDEX.LIST'”。
解决方案:
需要在app.gradle文件里面android节点下添加这样的代码,当项目中依赖的第三方库越来越多时,有可能会出现两个依赖库中存在同一个(名称)文件。如果这样,Gradle在打包时就会提示错误(警告)。那么就可以根据提示,然后使用以下方法将重复的文件剔除,比较常用的是通过exclude去除重复的文件,例如:


More|More than one file was found with OS independent path 'META-INF/INDEX.LIST'
文章图片
packagingOptions {
exclude 'META-INF/*******'
exclude 'META-INF/INDEX.LIST'
exclude 'META-INF/io.netty.versions.properties'
}

    推荐阅读