今天开发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. Libevent 反应堆的初始化

    // 默认情况下new eventbase struct event_base * event_base_new(void) { struct event_base *base = NULL; //初 ...

  2. Mac中配置nvm

    1.安装 nvm curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash 安装成功默认将 ...

  3. Scala入门系列(四):Map & Tuple

    Map 创建Map // 创建一个不可变的Map scala> val ages = Map("Leo" -> 30, "Sparks" -> ...

  4. 基于Node的高性能MVC框架

    赶上公司去Windows化,有一大波.net站点需要转成Node.js,于是自己就顺便琢磨一个通用的Node版MVC框架. 经过几天的努力,beta版终于面世了!因为其高性能的特点,特地命名node- ...

  5. 基于python2.7通过boto3实现ec2表格化

    #!/usr/bin/env python import xlwt,xlrd,datetime,json,os,xlutils.copy a={ 'VpcPeeringConnection': { ' ...

  6. Tomcat启动慢解决方法(本人CentOS7.4系统)

    首先查看日志信息,查看因为什么而启动慢 在CentOS7启动Tomcat时,启动过程很慢,需要几分钟,经过查看日志,发现耗时在这里:是session引起的随机数问题导致的.Tocmat的Session ...

  7. 动手开发一个名为“微天气”的微信小程序(上)

    引言:在智能手机软件的装机量中,天气预报类的APP排在比較靠前的位置.说明用户对天气的关注度非常高.由于人们不管是工作还是度假旅游等各种活动都须要依据自然天气来安排.跟着本文开发一个"微天气 ...

  8. [Contiki系列论文之1]Contiki——为微传感器网络而生的轻量级的、灵活的操作系统

    说明:本系列文章翻译自Contiki之父Adam Dunkels经典论文,版权归原作者全部. Contiki是由Adam Dunkels及其团队开发的系统,研读其论文是对深入理解Contiki系统的最 ...

  9. LDA主题模型学习笔记5:C源代码理解

    1.说明 本文对LDA原始论文的作者所提供的C代码中LDA的主要逻辑部分做凝视,原代码可在这里下载到:https://github.com/Blei-Lab/lda-c 这份代码实现论文<Lat ...

  10. zephyr初始化流程

    1.调用应用层main()函数         kernel/init.c      181行 /** * * @brief Mainline for kernel's background task ...