Error building Gradle Android Studio 1.5.1 (Error: Execution failed for task ': app: dexDebug'.)


I have the following error when trying to build my application,

Error:Execution failed for task ':app:dexDebug'.
> org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 2

I guess it has to do with the dependencies that I add to the project but I can not solve it, This is my Build.Gradle (app): apply plugin: ''

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    repositories {

    defaultConfig {
        applicationId "com.jmhe.corebo"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), ''

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile files('libs/gson-2.2.2.jar')
        compile files('libs/guava-17.0.jar')
        compile files('libs/mobileservices-2.0.3-javadoc.jar')
        compile files('libs/mobileservices-2.0.3-sources.jar')
        compile files('libs/mobileservices-2.0.3.jar')
        // compile ''
        compile project(':facebook')
        compile files('libs/json-simple-1.1.1.jar')
        compile ''
        compile ''
        compile 'com.squareup.picasso:picasso:2.5.2'
        compile ''

Before I built, the last thing I added to the project was the default template MapsActivity, with the rest everything was the same.

asked by Jomazao 08.01.2016 в 00:18

2 answers


It seems that your dependencies are being compiled 2 times:

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

That line compiles all the jar and then below you compile each one.

Check out this reference in English .

answered by 08.01.2016 в 00:36

Try adding multiDexEnabled true to build.gradle in defaultConfig.

 defaultConfig {
    multiDexEnabled true

Note: in some cases this not only does not solve it, but it generates more errors if this is the case undo the changes .

P.D: if the above solves the error, you may want to use only the part of the google services that interests you here, an example for analytics. Instead of using such compile '' when you could use compile '' for example if you only need the analytics , with this decrease the size of your APK and may not have to use the multiDexEnabled .

You can look at my answer here for similar cases: failed to want to raise my application in Android Studio 1.5.1 Execution (Error: Execution failed for task ': app: transformClassesWithDexForDebug'.)

answered by 11.01.2016 в 03:44