Duplicate files copied in APK META-INF on many libraries?

微笑、不失礼 提交于 2019-12-22 18:31:02

问题


I get this error when trying to build APK,

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/services/com.sun.jersey.spi.inject.InjectableProvider File1: /home/xxxxxxx/.gradle/caches/modules-2/files- 2.1/com.sun.jersey/jersey-core/1.19.1/4282d106f2acd5051bd9bc2935ed9a2920c9385/jersey-core-1.19.1.jar File2: /home/xxxxxxx/.gradle/caches/modules-2/files-2.1/com.sun.jersey.contribs/jersey- multipart/1.19.1/b8700842c5005dab05831319bc8f072d51e26396/jersey-multipart-1.19.1.jar

I can't find that I should have duplicates of dependencies.

Works when I exclude the file in build.gradle, but then I just get som other file that causing duplicate error.. feel strange that I should write this long exclude list.


回答1:


You can exclude this files on your build.gradle file:

packagingOptions {
    exclude 'META-INF/**'
    exclude 'META-INF/**'
}

Take a look at this question.



来源:https://stackoverflow.com/questions/38811753/duplicate-files-copied-in-apk-meta-inf-on-many-libraries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!