今天开发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. Nova控制节点集群

    #Nova控制节点集群 openstack pike 部署 目录汇总 http://www.cnblogs.com/elvi/p/7613861.html ##Nova控制节点集群 # control ...

  2. php常用面试题

    1. 有一列数的规则如下 1.1.2.3.5.8.13.21.34... 求第30位数是多少.写出相关函数和算法名称 //$pxx = array(1,1);//for($i=2;$i<=29; ...

  3. pipelineDB初体验

    官网:http://www.pipelinedb.com/ pipelineDB是基于postgres的stream数据库.完全兼容pg的东西. 由于产品需要解决性能这块瓶颈,老大让试试这款基于流计算 ...

  4. Linux send和recv

    1.send 函数 int send( SOCKET s, const char FAR *buf, int len, int flags ); 不论是客户还是服务器应用程序都用send函数来向TCP ...

  5. 基于Accord.Audio和百度语言识别

    ---恢复内容开始--- 目标需求 使用录音形式,模拟微信语音聊天.按住录音,松开发送语音,并完成语音识别. ps:百度的语言识别有60秒长度限制,需要自己做好控制. 实现方案 采用C# winfor ...

  6. Excel大写和小写转换函数

    Excel中的大写和小写转换函数 (1).转换为所有小写字母:lower函数 (2).转换为所有大写字母:upper函数 (3).转换为首字母大写,其余小写字母:proper函数 三种函数的使用方式. ...

  7. Amicable numbers -- Javascript 实现

    问题描写叙述: Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide eve ...

  8. C++学习笔记24,方法重写与方法隐藏

    该博文仅用于交流学习.请慎用于不论什么商业用途.本博主保留对该博文的一切权利. 博主博客:http://blog.csdn.net/qq844352155 转载请注明出处: 方法重写.是指在子类中又一 ...

  9. hdu 5635 LCP Array(BC第一题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5635 LCP Array Time Limit: 4000/2000 MS (Java/Others) ...

  10. 爬虫新手学习2-爬虫进阶(urllib和urllib2 的区别、url转码、爬虫GET提交实例、批量爬取贴吧数据、fidder软件安装、有道翻译POST实例、豆瓣ajax数据获取)

    1.urllib和urllib2区别实例 urllib和urllib2都是接受URL请求相关模块,但是提供了不同的功能,两个最显著的不同如下: urllib可以接受URL,不能创建设置headers的 ...