My Android Advanced tour------> resolution: Execution failed for task & #39;: App:transformresourceswithmergejavaresfordebug & #39;.

Source: Internet
Author: User

Description of the error

Today, I added the Jackson development package to the Android Studio project, which was compiled at the time of execution. An error such as the following is raised:

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/NOTICE    File1: D:\Code\XTCKuwoWatch\app\libs\jackson-core-2.4.4.jar    File2: D:\Code\XTCKuwoWatch\app\libs\jackson-databind-2.4.4.jar

Errors such as the following are seen:

How to Solve

This appears to be due to the inclusion of the same file (NOTICE.txt) in multiple jar packages. Causes errors when packaging is caused by worrying about each other's coverage issues. Try adding a configuration in the Android section of Build.gradle under app. As the following code sees:

{        exclude ‘META-INF/LICENSE‘        exclude ‘META-INF/NOTICE‘    }
    • Build.gradle file before the change
apply plugin:  ' com.android.application '  android { Compilesdkversion 22  buildtoolsversion  "22.0.1"  defaultconfig {applicationid  "com.oyp.csdn"  minsdkversion 16  targetsdkversion 23  versioncode 1  versionname " 1.0 "} buildtypes {release {min ifyenabled false  proguardfiles getdefaultproguardfile ( ' proguard-android.txt ' ),  ' Proguard-rules.pro ' }}}dependencies {C Ompile Filetree (dir :  ' Libs ' , include: [ ' *.jar ' ])} 
    • Build.gradle files after the change
Apply plugin:' Com.android.application 'Android {Compilesdkversion ABuildtoolsversion"22.0.1"packagingoptions {Exclude' Meta-inf/license 'Exclude' Meta-inf/notice '} defaultconfig {ApplicationID"COM.OYP.CSDN"Minsdkversion -Targetsdkversion atVersioncode1Versionname"1.0"} buildtypes {release {minifyenabledfalseProguardfiles Getdefaultproguardfile (' Proguard-android.txt '),' Proguard-rules.pro '}}}dependencies {Compile Filetree (dir:' Libs ', include: [' *.jar '])}
欧阳鹏 欢迎转载,与人分享是进步的源泉!转载请保留原文地址:http://blog.csdn.net/ouyang_peng

My Android Advanced tour------> resolution: Execution failed for task & #39;: App:transformresourceswithmergejavaresfordebug & #39;.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.