hiccup
hiccup

Reputation: 42

Execution failed for task ':app:dexDebug' | error in gradle build

I am getting this error after gradle build :

Error:Execution failed for task ':app:dexDebug'.

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

My build.gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 022
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.example.prashant.nuhani_go"
    minSdkVersion 14
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        debuggable true
        }
     }
   }

  dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
     compile project(':facebook')
     compile 'com.android.support:appcompat-v7:22.2.1'
     compile 'com.google.android.gms:play-services:7.5.0'
     compile 'com.google.android.gms:play-services-location:7.5.0'
     compile 'com.google.android.gms:play-services-maps:7.5.0'
     compile 'com.android.support:support-v4:22.2.1'
     compile files('libs/google-api-client-1.10.3-beta.jar')
     compile files('libs/google-api-client-android2-1.10.3-beta.jar')
     compile files('libs/google-http-client-1.10.3-beta.jar')
     compile files('libs/google-http-client-android2-1.10.3-beta.jar')
     compile files('libs/google-oauth-client-1.10.1-beta.jar')
     compile files('libs/jackson-core-asl-1.9.4.jar')
     compile files('libs/jsr305-1.3.9.jar')
     compile files('libs/android-google-maps-api13.jar')
 }

From some of the answers regarding the same kind of error I came to know that i need to delete some jars from compile under dependencies.

Help me out to figure out which one to keep and which one to delete. and also tell if there is any another solution for this problem.

Thanks

Upvotes: 0

Views: 309

Answers (1)

Lucas Crawford
Lucas Crawford

Reputation: 3118

This error happens from compiling the same jar files more than once.. in this line:

compile fileTree(dir: 'libs', include: ['*.jar'])

you are telling your gradle project to compile all the jars in the lib folder.

In these lines:

 compile files('libs/google-api-client-1.10.3-beta.jar')
 compile files('libs/google-api-client-android2-1.10.3-beta.jar')
 compile files('libs/google-http-client-1.10.3-beta.jar')
 compile files('libs/google-http-client-android2-1.10.3-beta.jar')
 compile files('libs/google-oauth-client-1.10.1-beta.jar')
 compile files('libs/jackson-core-asl-1.9.4.jar')
 compile files('libs/jsr305-1.3.9.jar')
 compile files('libs/android-google-maps-api13.jar')

You are once again telling the gradle project to compile various files in your libs folder. Remove the compile fileTree, or remove the compile files('libs/XXX') in order to fix this. With both remaining you will always get this error.

Upvotes: 1

Related Questions