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\Administrator\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.6.4\27d3a9f7bbdcf72d93c9b2da7017e39551bfa9fb\jackson-core-2.6.4.jar File2: C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.6.4\f2abadd10891512268b16a1a1a6f81890f3e2976\jackson-databind-2.6.4.jar File3: C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.6.0\a0990e2e812ac6639b6ce955c91b13228500476e\jackson-annotations-2.6.0.jar

转载请标明出处: http://www.cnblogs.com/why168888/p/5978381.html 本文出自:【Edwin博客园】

我引用compile 'com.squareup.retrofit2:converter-jackson:2.1.0'Gradle没有错误,运行APP就出了这个error。

错误日志: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

解决方法如下:

复制代码

android { compileSdkVersion 24 buildToolsVersion "24.0.3" defaultConfig { applicationId "com.edwin.xxxx" minSdkVersion 19 targetSdkVersion 24 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }** 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'**** }**}
复制代码

磨刀不误砍柴工

推荐阅读更多精彩内容