0

I'm getting this error while running my project.

Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

can anyone suggest me how to correct it?

This is my build.gradle file :

apply plugin: 'com.android.application'




android {




 compileSdkVersion 22

  buildToolsVersion "23.0.0 rc2"


    defaultConfig {
        applicationId "com.example.shreyatakkar.student"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}


dependencies {

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

    compile 'com.android.support:appcompat-v7:22.2.0'

}
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274

1 Answers1

1

I too was having this error after updating to the latest Android Studio.I fixed it by adding multiDexEnabled true in build.gradle within defaultConfig.

Example:

defaultConfig {
    applicationId "com.example.shreyatakkar.student"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
Psypher
  • 10,717
  • 12
  • 59
  • 83
  • It's possible but i don't think so. – M D Jul 12 '15 at 11:14
  • i did and now this error message is being displayed : Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. > java.util.zip.ZipException: duplicate entry: android/support/v4/util/LogWriter.class – shreya takkar Jul 12 '15 at 11:16
  • i added this and it worked ! configurations { all*.exclude group: 'com.android.support', module: 'support-v4' } – shreya takkar Jul 12 '15 at 11:59
  • Can you please add it as a separate answer with some details so that it will help others with the same problem.. – Psypher Jul 12 '15 at 12:53