• 干掉头疼的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
    }




  • 相关阅读:
    3星|《中国古城墙》:重要的古城墙的资料汇集
    bindingSource具体使用案例
    WPF第三方控件盘点
    FluentValidation具体使用案例
    Visual Studio 版本管理从TFS迁移到SVN
    Image.FromStream与Image.FromFile使用区别
    判断图片的格式的方法
    WCF测试小程序
    使用AutoMapper 处理DTO数据对象的转换
    获取mac地址和IP地址方式
  • 原文地址:https://www.cnblogs.com/muyuge/p/6333546.html
Copyright © 2020-2023  润新知