今天开发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. 纯css美化单选、复选框

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  2. 掌握NIO,程序人生

    就像新IO为java带来的革新那样,让我们也开启一段新的程序人生. 关键字:NIO,BIO,伪IO,AIO,多路复用选择器,通道,缓冲区,jdk研究,回调函数,高并发 java.nio 概述 历史背景 ...

  3. ios7 以后准确获取iphone设备的MAC(物理地址)

    通过参考 钉钉 项目,知道是通过wifi拿到路由的MAC地址.那么可不可以拿到iphone 设备的MAC 地址呢? 经过一番搜索,发现所有文章都是针对 ios 7 以前 可以拿到. 而且方法也都是同一 ...

  4. IIS网站本机可以访问但局域网其他机器无法访问 解决方法

    在IIS部署网站的时候,发现只有本机可以访问,通过localhost和IP地址都可以,但是当局域网其他机器访问我的网站的时候,无响应. 我的是WIN10的系统 解决方法:   网站所对应的端口必须对外 ...

  5. extr_shopping

    __author__ = 'ZZG' # noinspection PyCallingNonCallable shopping_list =[ ("iphone",5300), ( ...

  6. Express4.x API (二):Request (译)

    写在前面 最近学习express想要系统的过一遍API,www.expressjs.com是express英文官网(进入www.epxressjs.com.cn发现也是只有前几句话是中文呀~~),所以 ...

  7. Linux定义变量的脚本

    现有两段基本一样的代码,只是变量进行改变,其他都没有变化,但是执行过程中出现了不一样的结果 代码一: vi back.sh #backup import file,such as /etc/rc.lo ...

  8. HDU 1908 Double Queue(set)

    Problem Description The new founded Balkan Investment Group Bank (BIG-Bank) opened a new office in B ...

  9. toolbar ,textfield,图片拉伸,Bundle

    1   工具栏   UIToolbar 2   textField 协议方法 一旦TextField成为第一响应,此方法就会调用 - (void)textFieldDidBeginEditing:(U ...

  10. Android Api 检查參数状态Api

    转载请注明出处:http://blog.csdn.net/droyon/article/details/39938677 在进行Android应用程序开发中,android提供了一个非常好的工具类,来 ...