When I try to Run my app, I am getting this error:-
Error:Execution failed for task \':app:dexDebug\'.
> com.android.ide.common.process.ProcessException:
Just add below line in your app Gradle dependencies
compile 'com.android.support:multidex:1.0.0'
and then below line in defaultConfig
multiDexEnabled true
Edit gradle.properties file. change this line:
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
to:
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
Just do this Build > Clean project
It works
This happened for me when I was refactoring some class files to a library project and I had a duplicate name of a class file. So, double check that you do not have any duplicate names. This also appears to be a duplicate of the question here: android project: process finished with non-zero exit value 2
I got this error when I used the beta version of gradle to test Vector Asset. This error perssisted even after I switched back to stable Gradle version 1.3.0.
The error was fixed after I used Build > Clean project
Encountered same problem today. I fixed this problem by closing other applications to release more memory to finish build process.
When getting this error:
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2
Use process explorer to find out the command line parameter of java.exe, then run complete command in CMD window to see what the error message is. Mine contains "HeapDumpOnOutOfMemoryError", So I close other applications to release more memory, then problem fixed.