错误:执行失败的任务“:应用程序:transformResourcesWithMergeJavaResForDebug” [英] Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'
问题描述
所以我一直在试图运行我的项目接收gradle这个生成错误。我已经寻找其他的解决方案,有人说,加入:
packagingOptions {
排除META-INF /注意事项
}
我的应用程序的gradle.build会解决这个问题,但是,事实并非如此。这里是我的应用程序的gradle.build目前的样子。
应用插件:'com.android.application
应用插件:'com.google.gms.google的服务。依赖{
编译文件树(包括:['的* .jar'],DIR:库)
编译com.google.android.gms:播放服务:8.3.0
编译com.google.android.gms:播放服务的广告:8.3.0
编译com.google.android.gms:播放服务身份:8.3.0
编译com.firebase:火力点 - 客户端的Android版本:2.3.1
}安卓{
compileSdkVersion 23
buildToolsVersion '23 .0.1
useLibraryorg.apache.http.legacydefaultConfig {
的applicationIDcom.example.j.airportmeet
18的minSdkVersion
targetSdkVersion 23
版本code 1
的versionName1.0
multiDexEnabled真
}packagingOptions {
排除META-INF /注意事项
}buildTypes {
发布 {
minifyEnabled假
proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
}
}
}
编辑:完整的错误是这样的:
错误:执行失败的任务:应用程序:transformResourcesWithMergeJavaResForDebug。
>在APK META-INF /许可复制的重复文件:com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException
文件1: .gradle\\caches\\modules-2\\files-2.1\\com.fasterxml.jackson.core\\jackson-databind\\2.2.2\\3c8f6018eaa72d43b261181e801e6f8676c16ef6\\jackson-databind-2.2.2.jar
文件2: .gradle\\caches\\modules-2\\files-2.1\\com.fasterxml.jackson.core\\jackson-core\\2.2.2\\d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b\\jackson-core-2.2.2.jar
FILE3: .gradle\\caches\\modules-2\\files-2.1\\com.fasterxml.jackson.core\\jackson-annotations\\2.2.2\\285cb9c666f0f0f3dd8a1be04e1f457eb7b15113\\jackson-annotations-2.2.2.jar
随着错误消息,建议你不排除它存在于更多的 META-INF / LICENSE
文件比你的一个依赖
com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:重复的文件在APK META-INF /许可复制
块引用>packagingOptions {
排除META-INF / NOTICE'//将不包括通知文件
排除META-INF /许可'//将不包括许可文件
}So I'm continuously receiving a gradle build error upon trying to run my project. I have searched for other solutions and some say that adding:
packagingOptions { exclude 'META-INF/NOTICE' }
to my app's gradle.build would fix the issue, however, it doesn't. Here is what my app's gradle.build currently looks like.
apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.google.android.gms:play-services:8.3.0' compile 'com.google.android.gms:play-services-ads:8.3.0' compile 'com.google.android.gms:play-services-identity:8.3.0' compile 'com.firebase:firebase-client-android:2.3.1' } android { compileSdkVersion 23 buildToolsVersion '23.0.1' useLibrary 'org.apache.http.legacy' defaultConfig { applicationId "com.example.j.airportmeet" minSdkVersion 18 targetSdkVersion 23 versionCode 1 versionName "1.0" multiDexEnabled true } packagingOptions { exclude 'META-INF/NOTICE' } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
EDIT: The full error is this:
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: .gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.2.2\3c8f6018eaa72d43b261181e801e6f8676c16ef6\jackson-databind-2.2.2.jar File2: .gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.2.2\d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b\jackson-core-2.2.2.jar File3: .gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.2.2\285cb9c666f0f0f3dd8a1be04e1f457eb7b15113\jackson-annotations-2.2.2.jar
解决方案As the error message suggests you are not excluding the
META-INF/LICENSE
file which exists in more than one of your dependenciescom.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
packagingOptions { exclude 'META-INF/NOTICE' // will not include NOTICE file exclude 'META-INF/LICENSE' // will not include LICENSE file }
这篇关于错误:执行失败的任务“:应用程序:transformResourcesWithMergeJavaResForDebug”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!