zoukankan      html  css  js  c++  java
  • 干掉头疼的finished with non-zero exit value 2

    很多次会出现 finished with non-zero exit value 2  .

    Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:Program FilesJavajdkx.x.x_xxinjava.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'){
        exclude module: 'support-v4'
    }

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


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


    第二种情况的解决方案:

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

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

    defaultConfig {
       ...
       ...
       multiDexEnabled true
    }




  • 相关阅读:
    BFPRT(中位数的中位数算法)
    View的事件体系
    Android的消息机制
    BInder机制总结
    Service总结
    IPC机制总结
    AIDL使用绑定启动远程Service出现Service Intent must be explicit: Intent
    线程协作与并发流程控制&AQS
    TCP相关问题整理
    USACO 2015 US OPEN Gold T3: Trapped in the Haybales
  • 原文地址:https://www.cnblogs.com/muyuge/p/6333546.html
Copyright © 2011-2022 走看看