今天开发Android项目时,导入了http有关架包后,程序编译报错如下:

 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: G:\Android\LRWebService\app\libs\httpcore-4.4.1.jar
File2: G:\Android\LRWebService\app\libs\httpclient-4.4.1.jar

  报错信息截图如下:

  观察错误提示后得到错误原因:

    因为多个 jar 包里包含了同样的文件(LICENSE.txt),导致打包时因为担心相互覆盖问题而提示出错。

  尝试下在 app 下的 build.gradle 中的 android 部分增加一段配置,如下面这段代码所示:

 packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}

  具体加的位置如图所示位置:

  重新编译后,启动成功!

Android:Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.的更多相关文章

  1. Android:Error:Execution failed for task ':app:clean'. > Unable to delete directory

    as  clean项目之后有时候会报错. 可以找得到目录删掉,然后重启as,但是下次clean可能又会报类似的错误. 解决方法如下: 进入File-Setting-Build,Execution,De ...

  2. Android Studio 运行出现 Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.

    转载请标明出处: http://www.cnblogs.com/why168888/p/5978381.html 本文出自:[Edwin博客园] 我引用compile 'com.squareup.re ...

  3. 【Android】Error:Execution failed for task ':app:lint'

    详细信息如下: Error:Execution failed for task ':app:lint'. > Lint found errors in the project; aborting ...

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

    Information:Gradle tasks [:app:assembleDebug]Error:Execution failed for task ':app:transformResource ...

  5. 终极报错解决方案:Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with

    遇到这个报错的时候,不要慌 Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger fail ...

  6. Android Studio Error:Execution failed for task ':app:preDebugAndroidTestBuild'.彻底解决的方法以及修改AScompileSDKVersion

    Error Error:Execution failed for task ':app:preDebugAndroidTestBuild'. > Conflict with dependency ...

  7. [Exception Android 20] - Error:Execution failed for task ':app:processDebugResources'

    Error:Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.Pr ...

  8. Android Studio:Error:Execution failed for task ':app:mergeDebugResources'. > Some file crunching failed, see logs for details

    Gradle 编译错误: 14:39:58 Executing tasks: [clean, :app:generateDebugSources, :app:mockableAndroidJar, : ...

  9. 解决方案:Error:Execution failed for task ':app:compileDebugAidl'. > aidl is missing

    也许有朋友最初在用Android Studio创建新工程的时候会碰到这个错误,其实这个问题是由于版本不兼容导致的,解决方法很简单,只需要把编译工具的版本改一下就可以了: 1.选左侧的工程根目录app, ...

随机推荐

  1. Failed to load the JNI shared lib...

    启动eclipse报错:Failed to load the JNI shared lib... 解决办法如下:保证JDK与eclipse相匹配 在同一台计算机中,如果JDK是32位的,那么eclip ...

  2. 百度OCR文字识别-身份证识别

    简介 一.介绍 身份证识别 API 接口文档地址:http://ai.baidu.com/docs#/OCR-API/top 接口描述 用户向服务请求识别身份证,身份证识别包括正面和背面. 请求说明 ...

  3. mysql 双机热备注意事项

    上一篇文章已经介绍过    主从复制,   本文对主从复制只是简单描述,如对主从复制不清楚的,可以先看上一篇文章   主从复制  一:介绍 mysql版本:5.7.20 第一个主服服务器ip:192. ...

  4. 乘积最大洛谷p1018

    题目描述 今年是国际数学联盟确定的“2000――世界数学年”,又恰逢我国著名数学家华罗庚先生诞辰90周年.在华罗庚先生的家乡江苏金坛,组织了一场别开生面的数学智力竞赛的活动,你的一个好朋友XZ也有幸得 ...

  5. NOIP2017提高组初赛解析

    首发于订阅号 嗨编程,这是一个以嗨为目标的编程订阅号(仅仅是目标而已),扫码可关注,不定期更. 解析中引用了一张关于排序的总结课件图片,来源网络,如果侵权,请联系本人删除(没钱付版权费)

  6. eclipse中Cannot change version of project facet Dynamic Web Module to 2.5.

    Cannot change version of project facet Dynamic Web Module to 2.5.这个错误可能很多人都碰到过,这里网上查了一些资料,解决的问题.所以这里 ...

  7. AspNet Core Api Restful +Swagger 实现微服务之旅 (三)

    (1)  访问Rest ful接口时 Token验证  返回数据格式封装 (一)访问时Token验证  返回数据格式封装 1.1访问Api接口 方法 实现         1.1.1 创建访问Rest ...

  8. CSS clear 清除浮动,兼容各浏览器

    .clear:after{content:".";display:block;height:0;clear:both;visibility:hidden;} .clear{zoom ...

  9. Spring MVC新手教程(二)

    第一篇文章宏观讲了Spring MVC概念,以及分享了一个高速入门的样例. 这篇文章主要来谈谈Spring MVC的配置文件. 首先来谈谈web.xml: web项目启动时自己主动载入到内存中的信息, ...

  10. iOS_正則表達式

    iOS 正則表達式 正則表達式,又称正规表示法.常规表示法(英语:Regular Expression,在代码中常简写为regex.regexp或RE).计算机科学的一个概念. 正則表達式使用单个字符 ...