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 than one file was found with OS independent path 'META-INF/INDEX.LIST'_第1张图片

packagingOptions {

    exclude 'META-INF/*******' 

    exclude 'META-INF/INDEX.LIST'

    exclude 'META-INF/io.netty.versions.properties'

}

你可能感兴趣的:(More than one file was found with OS independent path 'META-INF/INDEX.LIST')