任务':app:dexDebug'非零退出值2的执行失败

时间:2016-04-24 10:25:36

标签: android android-gradle

错误:Gradle:任务':app:dexDebug'执行失败。

  

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'/usr/local/java/jdk1.8.0_73/bin/java''以非完成零退出值2   
  这个错误出现在我的所有项目中

build.gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.mukesh.airpollution"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile group: 'cz.msebera.android', name: 'httpclient', version: '4.4.1.1'
}

dependencies {
    compile 'com.android.support:recyclerview-v7:23.1.1'
}

dependencies {
    compile 'com.loopj.android:android-async-http:1.4.4'
}

dependencies {
    compile 'com.google.code.gson:gson:2.2.4'
}

dependencies {
    compile group: 'cz.msebera.android', name: 'httpclient', version: '4.4.1.1'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.google.maps.android:android-maps-utils:0.4+'
}

1 个答案:

答案 0 :(得分:1)

尝试压缩build.gradle,如下所示(删除 httpclient 的重复条目):

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.example.mukesh.airpollution"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.maps.android:android-maps-utils:0.4+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.loopj.android:android-async-http:1.4.4'
compile group: 'cz.msebera.android', name: 'httpclient', version: '4.4.1.1'
}

告诉我它是否有效?