Android: Execution failed for task ':dexDebug'
<p>I am currently facing a problem when I change the targetSDK version from 21 to 23.</p>

<p>After changing and the build the gradle, When I try to run the application am getting an error</p>

<pre><code>Error:Execution failed for task ':dexDebug'.
 &gt; com.android.ide.common.process.ProcessException:   org.gradle.process.internal.ExecException:
 Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 
</code></pre>

<p>In my lib folder I have a library called <strong>org.apache.http.legacy</strong></p>

<p>This library i added when change the sdk version from 21 to 23 , because in 23 it is depricated.</p>

<ul>
<li>Sync: OK </li>
<li>Make Project: OK</li>
<li>Clean: OK</li>
<li>Run: Error</li>
</ul>

<p>My gradle file is</p>

<pre><code>buildscript {
repositories {
    mavenCentral()
}
dependencies {

    classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'android'

 dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile('com.android.support:support-v4:21.0.3') {
    exclude module: 'support-v4'
}

configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
}

 android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'

defaultConfig {
    minSdkVersion 11
    targetSdkVersion 23

}
</code></pre>

<p>In my lib folder i have</p>

<ul>
<li>armeabi  </li>
<li>armeabi-v7a</li>
<li>x86</li>
<li>android-support-v4.jar</li>
<li>gcm.jar</li>
<li>json.jar</li>
<li>org.apache.http.legacy.jar</li>
<li>tint.jar</li>
<li>webproc.jar</li>
</ul>

<p>Can any please help me to resolve the error <strong>Error:Execution failed for task ':dexDebug'.finished with non-zero exit value 2</strong></p>

<p>I heard that it may because of jar issue. several times i delete and paste new jar from <strong>Local\Android\sdk\platforms\android-23\optional</strong>. But still facing the same issue</p>

<p>Can anyone please help me</p>