5

The Gradle Build console is showing this message.

Error: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_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

I was told that this problem is due to the wrong setting on the build.gradle file. My gradle file looks like this.

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc2"

defaultConfig {
    applicationId "com.marshall.gruppo"
    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'
compile project(':volley')
compile project(':android-support-v4')
}

What should I fix here?

Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67
  • 1
    Check out : http://stackoverflow.com/questions/28640314/android-studio-fails-to-debug-with-error-org-gradle-process-internal-execexcepti – Haresh Chhelana Jul 03 '15 at 13:26
  • @HareshChhelana Thanks for the feedback. I followed the suggestion, and now it shows another error! Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. > java.util.zip.ZipException: duplicate entry: android/support/v4/internal/view/SupportMenu.class –  Jul 03 '15 at 13:29
  • Update your question to reflect this new problem, that way you are more likely to find answers – Leo supports Monica Cellio Jul 03 '15 at 19:18
  • https://android-arsenal.com/details/1/1567 drop your apk here on this link and check if the number of methods are above 65k or not. I think your apk has more than 65k methods – Nadeem Iqbal Jul 04 '15 at 06:19

1 Answers1

3

Put this in your build.gradle:

android {
...
  defaultConfig {
    ...
    multiDexEnabled true
    ...
  }
...
}
...
dependencies {
   ...
   compile 'com.android.support:multidex:1.0.1'
   ...
}

and put this in your AndroidManifest.xml:

<application
...
android:name="android.support.multidex.MultiDexApplication"
...>
afathman
  • 5,993
  • 2
  • 20
  • 28