今天将团队的项目从gitlab拉下来,编译的过程中,报了个奇葩的错误:
More than one file was found with OS independent path 'META-INF/metadata.kot
翻译过来就是:
找到超过一个系统的文件,路径是‘META-INF/metadata.kot’
解决方案就是在app下的build.gralde的android {}模块里面添加要过滤的文件的配置:
android {
......
packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'
}
......
}
只要是提示类似上面的错误“More than one file was found with OS independent path ‘META-INF/xxx”,那么直接把提示的“META-INF/xxx”添加到packagingOptions {}里面就可以了,比如最终,我就在这个模块里面添加了下面这么多的过滤配置文件:
android {
......
packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'
exclude 'META-INF/metadata.kotlin_module'
exclude 'META-INF/metadata.jvm.kotlin_module'
}
......
}
然后再“Sync Now”,最后再“Rebuild Project”就可以了