Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'

    xiaoxiao2022-07-12  111

    * What went wrong: Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. > More than one file was found with OS independent path 'META-INF/proguard/androidx-annotations.pro'

    我们在平时的开发中,经常会导入很多库包,但是,库包与库包之间经常会存在一个相同的小文件,这个项目运行的时候,当存在相同的包时,编译过程就会出现异常,如下:

    弄清楚原理,解决还是比较快的。

    解决方法:在项目的build.gradle的android下面添加编译过程中出现的多余文件(地址),如下图这个就相当于把这个文件过滤剔除掉了,这样编译就不会出错。

    packagingOptions { exclude 'META-INF/proguard/androidx-annotations.pro' }
    最新回复(0)