导入Jackson-Core-1.x.x和Jackson-Mapper-1.x.x时,在APK错误打包期间收到重复文件

时间:2015-04-27 18:39:33

标签: android-studio jackson duplicates

我有一个项目依赖于旧Codehaus 1.x.x maven存储库中的Jackson-CoreJackson-Mapper

但是,当将两个作为库导入时,我收到duplicate files during packaging of APK错误。

有没有办法解决这个问题?

完整错误:

Error: duplicate files during packaging of APK C:\Users\Tukajo\AndroidStudioProjects\buruburu\app\build\outputs\apk\app-debug-unaligned.apk
Path in archive: META-INF/ASL2.0
Origin 1: C:\Users\USER\AndroidStudioProjects\buruburu\lib\libs\jackson-mapper-asl2-1.9.13.jar
Origin 2: C:\Users\USER\AndroidStudioProjects\buruburu\lib\libs\jackson-core-asl-1.9.13.jar

如果我补充:

    packagingOptions {
    exclude 'META-INF/ASL2.0'
}

到build.gradle文件...

我收到一个新错误:

> Duplicate files copied in APK META-INF/LICENSE
File 1: C:\Users\USER\AndroidStudioProjects\buruburu\lib\libs\jackson-mapper-asl2-1.9.13.jar
File 2: C:\Users\USER\AndroidStudioProjects\buruburu\lib\libs\jackson-mapper-asl2-1.9.13.jar

1 个答案:

答案 0 :(得分:0)

在gradle中像下面那样指导解决了这个问题。这是正确的做法还是推荐的?不确定。

android {

    //Other scripts

    packagingOptions {
        pickFirst "**"
    }

}