Flutter Plugin "More than one file" 编译报错
报错内容如下
:app:mergeDebugJavaResource:
More than one file was found with OS independent path 'org/bouncycastle/x509/CertPathReviewerMessages_de.properties'.
![](https://img.haomeiwen.com/i5320748/23428962e510f6e5.png)
报错原因:
同时引入这两个库时, 有文件冲突, 冲突文件如上图所示
implementation(name: "shaobingSdk-2.0.4-debug", ext: "aar")
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.68'
查找并确认具体重复文件位置:
![](https://img.haomeiwen.com/i5320748/2c7b3f84e7118967.png)
![](https://img.haomeiwen.com/i5320748/33f67a1da354f86b.png)
解决方案
在app目录下的build.gradle添加配置,
android {
packagingOptions {
pickFirst 'org/bouncycastle/x509/CertPathReviewerMessages_de.properties'
pickFirst 'org/bouncycastle/x509/CertPathReviewerMessages.properties'
}
}
踩坑注意:
因为是flutter plugin, 我在plugin下的build.gradle添加如上配置是不生效的, 必须在主工程内添加才有用!!! 必须在主工程内添加才有用!!! 必须在主工程内添加才有用!!!
网友评论