干掉头疼的finished with non-zero exit value 2

来源:互联网 发布:mysql自增id 编辑:程序博客网 时间:2024/04/28 12:11
 finished with non-zero exit value 2  .

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdkx.x.x_xx\bin\java.exe'' finished with non-zero exit value 2  


问群里小伙伴多数答案是:

1.clean   2.rebuild 3.重启 4.跳楼


可这几种方法往往不能解决问题。于是再一次遇到之后,求助stackoverflow 得到了以下说法:


There are two main reasons for this to happen

  1. You have same library or jar file included several places and some of them conflicting with each other.
  2. You are about or already exceed 65k method limit
大意是说,两种情况。

1.你的jar包或者库有重复。

2.你的方法超过65535。








第一种解决方案如下:

找出重复的依赖。

gradlew -q dependencies yourProjectName_usually_app:dependencies--configuration compile

 

多次排除之后 可能会得到

compile ('com.facebook.android:facebook-android-sdk:4.0.1'){    excludemodule: 'support-v4'}

最后删除重复依赖的jar或者库即可。


说人话: 比如你的support v4重复依赖了。删除就好了。


第二种情况的解决方案:

1.尽量减少类的方法 和jar包类库。

2.如果第一条做不到则:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. defaultConfig {  
  2.    ...  
  3.    ...  
  4.    multiDexEnabled true  
  5. }  
0 0
原创粉丝点击