【Android】Android studio 编译问题:finished with non-zero exit value 2

1.Android studio 编译问题:finished with non-zero exit value 2

  • 问题:
Error:Execution failed for task ':androidShopNC2014Moblie:transformClassesWithDexForDebug'.
>
com.android.build.api.transform.TransformException: 
com.android.ide.common.process.ProcessException: 
java.util.concurrent.ExecutionException: 
com.android.ide.common.process.ProcessException: 
org.gradle.process.internal.ExecException: 
Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
  • 解决方案

这个错误在app的build.gradle里面添加下面这句就好了。

android { 
defaultConfig { 
multiDexEnabled true
      }
}

2.Android studio 编译问题:finished with non-zero exit value 1(由于导入的依赖出现重复造成的)

  • 问题:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

> com.[Android](http://lib.csdn.net/base/15).build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'F:\Program Files (x86)\[Java](http://lib.csdn.net/base/17)\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 1
  • 解决方案

这个是因为依赖包重复了 (像v4和nineoldandroids),app中实现了对easeUI的依赖,但是app和easeUI都添加了对这个包的依赖。所以就报这个错误,修改之后再报,就clean,rebuild一下。

3.Android studio 编译问题:finished with non-zero exit value 1(由于buildtools版本太高造成的)

  • 错误
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: 
org.gradle.process.internal.ExecException: 
Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
  • 错误原因

buildToolsVersion版本太高,我原来的 buildToolsVersion “24.0.0” 需要jdk1.8,而我的是jdk1.7,所以一直报这个错,刚开始以为是v4包和V7包冲突,因为之前遇到这样的问题,而这次删除V4包之后依然报这个错,上stackoverflow搜了一下,把buildTools版本降下来就好了。

  • 解决方案
//build.gradle
android {    
compileSdkVersion 23    
buildToolsVersion "23.0.3"  
}
    原文作者:Neo007
    原文地址: https://www.cnblogs.com/Neo007/p/7823068.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞