Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

:app:dexDebug ExecException finished with non-zero exit value 2

Could anyone help me out with the following error. When i clean the project, it doesn't show any error but every time i try to run i get this message.

Error:Execution failed for task ':app:dexDebug'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2

The application was running with no errors but as my system crashed and restarted android studio i had few updates for Android API 22. After the update the application keep giving me this error message. I downloaded JDK 8 and tried to run but didn't work. Later i downgraded to JDK 7 after this stack post but still has not fixed it. Is it possible to use Java 8 for Android development?

I have looked through numerous similar question but none works for me. Some similar issues found on stack were

why java.exe exit with value 1 in android studio

Error:Execution failed for task ':app:dexDebug'. > comcommand finished with non-zero exit value 2

Java finished with non-zero exit value 2 - Android Gradle

java.exe finished with non-zero exit value 2

Process 'command' C: \ Program Files \ Java \ jdk1.8.0_31 \ bin \ java.exe '' finished with a non -zero exit value 2

I have looked through dependencies in gradle built to see if there were any conflict but found none.

I even tried to copy the code into a new project and run it but still no success. Anyone who has faced the same issue and solved it please help me out.

like image 696
Prajun Adhikary Avatar asked May 02 '15 10:05

Prajun Adhikary


2 Answers

After days of trying out finally could fix the issue. The problem with one of my .jar files. I had to remove each jar and check one by one until i found it. I removed the .jar file and cleaned my project and ran successfully. If any one should face similar issue check your jar file one by one.

like image 73
Prajun Adhikary Avatar answered Jan 20 '23 15:01

Prajun Adhikary


I had the same error

app:dexDebug ExecException finished with non-zero exit value 2

i solve it by adding this line of code

defaultConfig {
        multiDexEnabled true
}

The reason is that i was using too many libraries

Hope this post will help anyone

like image 22
Netero Avatar answered Jan 20 '23 16:01

Netero