进程'命令'以非零退出值结束

时间:2016-05-02 18:11:03

标签: android android-gradle

我在android studio中开发了一个android项目,但是当我运行该项目时,我收到了这个错误:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2

那我怎么能摆脱这个错误?

这是我的 build.gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.abc.project1"
        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.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile files('libs/android-support-v4.jar')
    compile files('libs/mongo-2.10.1.jar')
    compile files('libs/org.apache.httpcomponents.httpclient_4.5.2.jar')
    compile files('libs/okhttp-3.2.0.jar')
    compile files('libs/org.apache.http.legacy.jar')
}

1 个答案:

答案 0 :(得分:1)

您要添加两次相同的依赖项。

从build.gradle文件中删除compile files('libs/android-support-v4.jar')

同时从项目中删除libs/android-support-v4.jar(因为compile fileTree(dir: 'libs', include: ['*.jar'])您要再次添加它。