Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’

The error

Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’. com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/usr/lib/jvm/java-8-oracle/bin/java” finished with non-zero exit value 1

My app gradle file:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId 'Hidden application ID'
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        disable 'InvalidPackage'
    }
    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }
    productFlavors {
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile 'com.googlecode.libphonenumber:libphonenumber:7.2.1'
    compile 'com.getbase:floatingactionbutton:1.10.1'
    compile 'com.android.support:preference-v7:23.1.1'
}

While debugging, if I set minifyEnabled to true, then it compiles. However, then I cannot debug my application.

I checked this other question: Execution failed for task ‘:app:transformClassesWithDexForDebug’ while implementing Google sign in for Android, but there is only one answer and implementing it does not resolve the issue unfortunately.

AFAIK, the error is caused due to addition of too many Gradle dependencies, but I may be wrong (I really hope to be wrong because all these packages are really important!).

Please help me to resolve this error. Much thanks!

Leave a Comment