异常Log:

Error:Execution failed for task ‘:app:dexDebug’. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/Library/……/java” finished with non-zero exit value 2

错误原因:

这个异常在Android Studio编译运行的时候出现,原因是项目中引用了重复的jar包,这可能是因为新引入的library module中有和主项目中重复引用的jar包,需要重点检查 Android 兼容包 support-v4 和 support-v7 包,还有一些常用的开源项目,例如Gson,Nineoldandroids…,这些常用的开源项目有可能在你引用的 library 项目中已经被引用过了。

解决办法:

解决这个问题我们只需要删除主项目中 libs 文件夹中和 library中重复的部分即可,另外,我推荐大家改变将 jar 包放在 libs 目录中的习惯,而使用 Gradle 构建,在 module 下的 build.gradle 目录下将

dependencies {compile files('libs/nineoldandroids-2.4.0.jar')
}
  • 1
  • 2
  • 3

dependencies {compile fileTree(dir: 'libs', include: ['*.jar'])
}
  • 1
  • 2
  • 3

改为

dependencies {compile 'com.nineoldandroids:library:2.4.0'
}
  • 1
  • 2
  • 3

在参考链接中,我发现一个类似的异常

Error:Execution failed for task ‘:app:dexDebug’. 
> com.android.ide.common.internal.LoggedErrorException

出现这个错误是因为主项目和Library项目中都引用了 compile ‘com.nineoldandroids:library:2.4.0’ ,但我在最新的 Android Studio 1.3 Preview 和 Gradle 2.3中给主项目和Library项目进行了一次模拟,却没有出现该异常,根据问题中给出了 build.gradle 文件,这可能是因为使用了低版本Android Studio 或 Gradle 的缘故,所以大家最好还是在项目中检查一下,library项目中已经引入的jar,library就不要再引入到主项目中了。

参考链接:

http://stackoverflow.com/questions/27675717/gradle-error-execution-failed-for-task-appdexdebug/27675841

转载于:https://www.cnblogs.com/zishentai-1/p/4932149.html

Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException相关推荐

  1. Error:Execution failed for task ':myapp:dexDebug'. com.android.ide.common.process.ProcessExcepti

    错误如题所示:Error:Execution failed for task ':myapp:dexDebug'. com.android.ide.common.process.ProcessExce ...

  2. android dex2oatd e,解決android項目Error:Execution failed for task ':app:dexDebug'.ebug'錯誤

    先上錯誤信息:Error:Execution failed for task ':app:dexDebug'.> com.android.ide.common.process.ProcessEx ...

  3. Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.tran

    错误造成的原因: 为了连接网络,我导入的一个Xutils的jar包,然后发现还是还是有原理的老问题,编译版本太高了,需要相应的moudle中增加 在相应的module下的build.gradle中加入 ...

  4. 完美解决Error:Execution failed for task ':APP:transformClassesWithDexForDebug'...问题

    今天下载一个demo运行出现问题,错误如下图 我的问题是JDK 1.8 版本问题问题,我吧1.8改成1.7运行成功 这个实在app下面的build.gradle 相信大伙在Android开发过程中都避 ...

  5. 安卓中运行报错Error:Execution failed for task ':app:transformClassesWithDexForDebug'解决

    在androidstuio中运行我的未完项目,报错: Error:Execution failed for task ':app:transformClassesWithDexForDebug'. & ...

  6. 安卓开发遇到Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

    问题如下: Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api. ...

  7. Error:Execution failed for task ':app:transformClassesWithDexForDebug'解决记录

    3个错误non-zero exit value 1: non-zero exit value 2: non-zero exit value 3(一下方法亲测好用) Error:Execution fa ...

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

    解决方案:Error:Execution failed for task ':app:compileDebugAidl'. > aidl is missing 参考文章: (1)解决方案:Err ...

  9. Error:Execution failed for task ':app:clean'.

    运行时出现 Error:Execution failed for task ':app:clean'. 错误,Builld->Clean Project即可. 转载于:https://www.c ...

最新文章

  1. 【转】Asp.net控件开发学习笔记整理篇 - WebControl基类
  2. array_uniquee php_【性能为王】从PHP源码剖析array_keys和array_unique
  3. ajax前台multipartfile,在SpringBoot中使用Ajax方式MultipartFile上传失败
  4. hello ,test livewriter
  5. 多线程暂停的一些方法区别
  6. 合并两个有序链表-递归
  7. java开发面试自我介绍模板_java程序员面试自我介绍范文(精选3篇)
  8. python round函数
  9. html如何设置自动点击事件,使用javascript给html元素添加click事件
  10. 减少资源占用 Vista操作系统瘦身大法
  11. Go手动安装pkg包初体验
  12. 学术论文检索--搜索引擎篇
  13. 8.3 单位矩阵和逆矩阵
  14. 让iPad认识一下Windows系统
  15. 红米note3全网通版刷机救砖 9008强刷(无需短接)
  16. 大数据毕设 - 网络游戏数据分析与可视化(python 大数据)
  17. python爬虫设计模式_Python爬虫进阶一之爬虫框架概述
  18. 抖音怎么注销账号?操作流程步骤有哪些?
  19. FCC JavaScript 算法和数据结构 正则表达式
  20. Fragment overlap problem

热门文章

  1. c 宏定义用法#define
  2. 调用API弹出打印机属性对话框
  3. web标准的商业价值
  4. 巧用CSS的RevealTrans滤镜
  5. DataBind数据核心
  6. ATL::CStringA和std::string之间转换的一些误区
  7. OpenCV支持的图像格式
  8. opencv图像处理梯度边缘和角点
  9. c语言规定预处理命令必须以什么开头,C语言规定预处理命令必须以___________开头...
  10. 学计算机一定要加班吗,老梁推荐:毕业后经常加班的几类专业,工作压力大,对能力要求很高...