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

来源:互联网 发布:大数据工程师加班吗 编辑:程序博客网 时间:2024/05/16 06:22

今天在gitHup上fork了一个demo借鉴学习,再编译运行的时候遇到了下面的错误:


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/LICENSE
    File1: C:\Users\li\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.7.2\8b8310381b690e317f5f0574e9b2dd7034778b4c\jackson-core-2.7.2.jar
    File2: C:\Users\li\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.7.0\19f42c154ffc689f40a77613bc32caeb17d744e3\jackson-annotations-2.7.0.jar

    File3: C:\Users\li\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.7.2\84ffa765dd258dbab8695963c41308b054f3a1cb\jackson-databind-2.7.2.jar


解决方案:

packagingOptions{    exclude 'META-INF/NOTICE' // will not include NOTICE file    exclude 'META-INF/LICENSE' // will not include LICENSE file    // as noted by @Vishnuvathsan you may also need to include    // variations on the file name. It depends on your dependencies.    // Some other common variations on notice and license file names    exclude 'META-INF/notice'    exclude 'META-INF/notice.txt'    exclude 'META-INF/license'    exclude 'META-INF/license.txt'}

0 0